-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFeed.py
65 lines (60 loc) · 1.43 KB
/
Feed.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from FeedItem import FeedItem
'''
[
{
"id": 15168744039,
"orderSeq": 1578034902175,
"lastModified": "03.01.2020 09:01",
"itemType": 1,
"actionType": 1,
"hot": false,
"gradeTypeId": 18,
"gradeTypeAdditionalDesc": null,
"abbr": "B",
"authorName": "Kristi Juuse",
"lessonDate": null,
"subjectName": "F\\u00fc\\u00fcsika",
"subjectId": 3934750370,
"termName": null,
"textContent": "",
"hasStatistics": true,
"test": false,
"amendment": false
},
{
"id": 15168744032,
"orderSeq": 1578034874017,
"lastModified": "03.01.2020 09:01",
"itemType": 1,
"actionType": 1,
"hot": false,
"gradeTypeId": 5,
"gradeTypeAdditionalDesc": null,
"abbr": "B",
"authorName": "Kristi Juuse",
"lessonDate": null,
"subjectName": "F\\u00fc\\u00fcsika",
"subjectId": 3934750370,
"termName": null,
"textContent": "",
"hasStatistics": true,
"test": true,
"amendment": false
}...
]
'''
# Voo class
class Feed:
def __init__(self, raw_obj):
self.parse(raw_obj)
def parse(self, raw_obj):
self.feed = []
for feed_item_raw in raw_obj:
feeditem = FeedItem(feed_item_raw)
# Ära lisa reklaame. Reklaamide ID on 20
try:
if (feeditem.item_type == 20):
continue
except:
pass
self.feed.append(FeedItem(feed_item_raw))