■ ■ ■ ■ ■ ■
snscrape/modules/reddit.py
| skipped 19 lines |
20 | 20 | | @dataclasses.dataclass |
21 | 21 | | class Submission(snscrape.base.Item): |
22 | 22 | | author: typing.Optional[str] # E.g. submission hf7k6 |
23 | | - | created: datetime.datetime |
| 23 | + | date: datetime.datetime |
24 | 24 | | id: str |
25 | 25 | | link: typing.Optional[str] |
26 | 26 | | selftext: typing.Optional[str] |
| skipped 1 lines |
28 | 28 | | title: str |
29 | 29 | | url: str |
30 | 30 | | |
| 31 | + | created = snscrape.base._DeprecatedProperty('created', lambda self: self.date, 'date') |
| 32 | + | |
31 | 33 | | def __str__(self): |
32 | 34 | | return self.url |
33 | 35 | | |
| skipped 2 lines |
36 | 38 | | class Comment(snscrape.base.Item): |
37 | 39 | | author: typing.Optional[str] |
38 | 40 | | body: str |
39 | | - | created: datetime.datetime |
| 41 | + | date: datetime.datetime |
40 | 42 | | id: str |
41 | 43 | | parentId: typing.Optional[str] |
42 | 44 | | subreddit: typing.Optional[str] |
43 | 45 | | url: str |
44 | 46 | | |
| 47 | + | created = snscrape.base._DeprecatedProperty('created', lambda self: self.date, 'date') |
| 48 | + | |
45 | 49 | | def __str__(self): |
46 | 50 | | return self.url |
47 | 51 | | |
| skipped 63 lines |
111 | 115 | | |
112 | 116 | | kwargs = { |
113 | 117 | | 'author': d.get('author'), |
114 | | - | 'created': datetime.datetime.fromtimestamp(d['created_utc'], datetime.timezone.utc), |
| 118 | + | 'date': datetime.datetime.fromtimestamp(d['created_utc'], datetime.timezone.utc), |
115 | 119 | | 'url': f'https://old.reddit.com{permalink}', |
116 | 120 | | 'subreddit': d.get('subreddit'), |
117 | 121 | | } |
| skipped 74 lines |
192 | 196 | | |
193 | 197 | | while True: |
194 | 198 | | # Return newer first; if both have the same creation datetime, return the comment first |
195 | | - | if tipSubmission.created > tipComment.created: |
| 199 | + | if tipSubmission.date > tipComment.date: |
196 | 200 | | yield tipSubmission |
197 | 201 | | try: |
198 | 202 | | tipSubmission = next(submissionsIter) |
| skipped 84 lines |