collect_twitter_list_posts
Documentation for eth_defi.feed.collector.collect_twitter_list_posts function.
- collect_twitter_list_posts(db, sources, *, list_id, bearer_token, twitter_user_cache, max_tweets, fallback_max_tweets=5, label='Twitter list')
Collect Twitter/X posts through a single X list timeline read.
The list timeline API returns tweets across all list members in reverse chronological order. This lets production collection avoid one API call per tracked account while still storing posts under the account-specific tracked source rows.
When a handle has no tweets in the list timeline and has no stored
last_post_published_at(i.e. it is a brand-new handle whose first scan returned nothing), the collector falls back to a single individual timeline read. This seeds the timestamp and stores a small number of recent posts without firing per-account API calls on steady-state runs where the list stopped early because all recent tweets were already known.- Parameters
db (eth_defi.feed.database.VaultPostDatabase) – Vault post database.
sources (Sequence[eth_defi.feed.sources.TrackedPostSource]) – Twitter tracked sources whose handles are represented in the X list.
list_id (str) – Numeric X list ID.
bearer_token (str) – X API bearer token used for list timeline reads.
twitter_user_cache (eth_defi.feed.twitter_api.TwitterUserCache) – Cache containing handle-to-user-ID mappings.
max_tweets (int) – Maximum tweets to read from the list timeline.
fallback_max_tweets (int) – Maximum tweets to fetch per account when the list timeline returns zero results for that handle. Used to populate
last_post_published_atfor inactive accounts. Defaults to 5.label (str) – Dashboard label for this collection phase.
- Returns
Collector run summary with per-source insert counters.
- Return type