twitter: use created_at as an extra key for merging
This commit is contained in:
parent
4104f821fa
commit
44a6b17ec3
1 changed files with 5 additions and 1 deletions
|
@ -18,9 +18,13 @@ def merge_tweets(*sources: Iterator[Res[Tweet]]) -> Iterator[Res[Tweet]]:
|
||||||
if isinstance(r, Exception):
|
if isinstance(r, Exception):
|
||||||
return str(r)
|
return str(r)
|
||||||
else:
|
else:
|
||||||
return r.id_str
|
# using both fields as key makes it a bit easier to spot TZ issues
|
||||||
|
return (r.id_str, r.created_at)
|
||||||
yield from unique_everseen(chain(*sources), key=key)
|
yield from unique_everseen(chain(*sources), key=key)
|
||||||
|
|
||||||
|
|
||||||
def permalink(*, screen_name: str, id: str) -> str:
|
def permalink(*, screen_name: str, id: str) -> str:
|
||||||
return f'https://twitter.com/{screen_name}/status/{id}'
|
return f'https://twitter.com/{screen_name}/status/{id}'
|
||||||
|
|
||||||
|
# NOTE: tweets from archive are coming sorted by created_at
|
||||||
|
# NOTE: tweets from twint are also sorted by created_at?
|
||||||
|
|
Loading…
Add table
Reference in a new issue