twitter module: prettify top level twitter.all
This commit is contained in:
parent
c410daa484
commit
03773a7b2c
7 changed files with 75 additions and 55 deletions
|
@ -1,24 +1,23 @@
|
|||
"""
|
||||
Unified Twitter data (merged from the archive and periodic updates)
|
||||
"""
|
||||
from itertools import chain
|
||||
|
||||
from . import twint
|
||||
from . import archive
|
||||
# NOTE: you can comment out the sources you don't need
|
||||
|
||||
|
||||
# TODO move to .common?
|
||||
def merge_tweets(*sources):
|
||||
from more_itertools import unique_everseen
|
||||
yield from unique_everseen(
|
||||
chain(*sources),
|
||||
key=lambda t: t.id_str,
|
||||
)
|
||||
from . import twint, archive
|
||||
from .common import merge_tweets
|
||||
|
||||
|
||||
def tweets():
|
||||
yield from merge_tweets(twint.tweets(), archive.tweets())
|
||||
yield from merge_tweets(
|
||||
twint .tweets(),
|
||||
archive.tweets(),
|
||||
)
|
||||
|
||||
|
||||
def likes():
|
||||
yield from merge_tweets(twint.likes(), archive.likes())
|
||||
yield from merge_tweets(
|
||||
twint .likes(),
|
||||
archive.likes(),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue