feat(twitter): expose has_media and media_urls columns#1115
Merged
jackwener merged 1 commit intojackwener:mainfrom Apr 21, 2026
Merged
feat(twitter): expose has_media and media_urls columns#1115jackwener merged 1 commit intojackwener:mainfrom
jackwener merged 1 commit intojackwener:mainfrom
Conversation
Adds two additive columns to the Twitter read commands (search, timeline, tweets, thread, likes): - has_media: boolean — true if the tweet contains any photo, video, or GIF - media_urls: string[] — photo URLs and mp4 variant URLs for videos/GIFs, extracted from legacy.extended_entities.media (falls back to entities.media) The INTERCEPT/COOKIE payloads already carry this data; this change only extends the row-mapping layer, so no new network work is needed. Pattern mirrors jackwener#465 (time column). Shared extraction helper lives in clis/twitter/shared.js so all five adapters stay consistent, with unit coverage for photo, video (mp4 variant selection), animated_gif, entities.media fallback, and the empty case. Closes jackwener#1107
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
has_media(boolean) andmedia_urls(string[]) columns to the Twitter read commands —search,timeline,tweets,thread,likes— so downstream pipelines can filter tweets that carry photos / videos / GIFs without launchingtwitter downloadper tweet.Closes #1107.
This is an additive, non-breaking column change. The existing INTERCEPT / COOKIE payloads already carry
legacy.extended_entities.media; the adapter-side change is purely in the row-mapping layer, so no new network work is introduced. Pattern mirrors #465 (thetime/created_atcolumn).Approach
extractMedia(legacy)inclis/twitter/shared.js:media_url_httpsvideo/mp4variant fromvideo_info.variants, fall back tomedia_url_httpsthumbnail if no mp4 is presentlegacy.entities.mediawhenextended_entitiesis missing{ has_media: false, media_urls: [] }for the empty casecolumnsarray so existing column-index consumers aren't disrupted.Tests
clis/twitter/shared.test.jscovers the helper directly: empty case, photos, video mp4-variant selection, animated_gif,entities.mediafallback, and the no-variants fallback.search.test.jsresult assertions andtweets.test.jscolumns assertion to include the new fields.