Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Twitter/X] TypeError when downloading an accounts liked tweets #4499

Closed
dtbead opened this issue Sep 4, 2023 · 2 comments
Closed

[Twitter/X] TypeError when downloading an accounts liked tweets #4499

dtbead opened this issue Sep 4, 2023 · 2 comments

Comments

@dtbead
Copy link

dtbead commented Sep 4, 2023

it'll download a few likes before eventually encountering this error

verbose output

gallery-dl --ignore-config -c config.json --cookies cookies.txt https://twitter.com/sugarcollars/likes -o skip=true -v
[gallery-dl][debug] Version 1.26.0-dev
[gallery-dl][debug] Python 3.11.3 - Windows-10-10.0.22621-SP0
[gallery-dl][debug] requests 2.31.0 - urllib3 2.0.4
[gallery-dl][debug] Configuration Files ['config.json']
[gallery-dl][debug] Starting DownloadJob for 'https://twitter.com/sugarcollars/likes'
[twitter][debug] Using TwitterLikesExtractor for 'https://twitter.com/sugarcollars/likes'
[twitter][debug] Loading cookies from 'cookies.txt'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): twitter.com:443
[urllib3.connectionpool][debug] https://twitter.com:443 "GET /i/api/graphql/XA6F1nJELYg65hxOC2Ekmg/UserByScreenName?variables=%7B%22screen_name%22%3A%22sugarcollars%22%2C%22withSafetyModeUserFields%22%3Atrue%7D&features=%7B%22hidden_profile_likes_enabled%22%3Afalse%2C%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Afalse%2C%22subscriptions_verification_info_verified_since_enabled%22%3Atrue%2C%22highlights_tweets_tab_ui_enabled%22%3Atrue%2C%22creator_subscriptions_tweet_preview_api_enabled%22%3Atrue%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%7D HTTP/1.1" 200 895
[urllib3.connectionpool][debug] https://twitter.com:443 "GET /i/api/graphql/6JET1d0iHsIzW0Zjs3OOwQ/Likes?variables=%7B%22userId%22%3A%221066881595817291778%22%2C%22count%22%3A100%2C%22includePromotedContent%22%3Afalse%2C%22withClientEventToken%22%3Afalse%2C%22withBirdwatchNotes%22%3Afalse%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Atrue%7D&features=%7B%22rweb_lists_timeline_redesign_enabled%22%3Atrue%2C%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Afalse%2C%22creator_subscriptions_tweet_preview_api_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Atrue%2C%22tweet_awards_web_tipping_enabled%22%3Afalse%2C%22freedom_of_speech_not_reach_fetch_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Afalse%2C%22interactive_text_enabled%22%3Atrue%2C%22responsive_web_text_conversations_enabled%22%3Afalse%2C%22longform_notetweets_rich_text_read_enabled%22%3Atrue%2C%22longform_notetweets_inline_media_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D HTTP/1.1" 200 49897
[urllib3.connectionpool][debug] https://twitter.com:443 "GET /i/api/graphql/JlLZj42Ltr2qwjasw-l5lQ/TweetDetail?variables=%7B%22focalTweetId%22%3A%221698461617770377367%22%2C%22referrer%22%3A%22profile%22%2C%22with_rux_injections%22%3Afalse%2C%22includePromotedContent%22%3Atrue%2C%22withCommunity%22%3Atrue%2C%22withQuickPromoteEligibilityTweetFields%22%3Atrue%2C%22withBirdwatchNotes%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Atrue%7D&features=%7B%22rweb_lists_timeline_redesign_enabled%22%3Atrue%2C%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Afalse%2C%22creator_subscriptions_tweet_preview_api_enabled%22%3Atrue%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Atrue%2C%22tweet_awards_web_tipping_enabled%22%3Afalse%2C%22freedom_of_speech_not_reach_fetch_enabled%22%3Atrue%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Afalse%2C%22interactive_text_enabled%22%3Atrue%2C%22responsive_web_text_conversations_enabled%22%3Afalse%2C%22longform_notetweets_rich_text_read_enabled%22%3Atrue%2C%22longform_notetweets_inline_media_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%7D HTTP/1.1" 200 7941
[twitter][debug] Using download archive 'archive.sqlite3'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): video.twimg.com:443
[urllib3.connectionpool][debug] https://video.twimg.com:443 "GET /ext_tw_video/1698415708688785408/pu/vid/800x600/ifuRB62bpn3hB_0q.mp4?tag=12 HTTP/1.1" 200 1784312
* .\gallery-dl\twitter\1698461617770377367_1.mp4
[twitter][debug] Skipping 1698463575512125564 (reply)
[twitter][debug] Skipping 1698462727109263551 (reply)
[twitter][debug] Skipping 1698463416271213051 (reply)
[twitter][error] An unexpected error occurred: TypeError - int() argument must be a string, a bytes-like object or a real number, not 'NoneType'. Please run gallery-dl again with the --verbose flag, copy its output and report this issue on https://github.com/mikf/gallery-dl/issues .
[twitter][debug]
Traceback (most recent call last):
  File "C:\Users\dtbead\AppData\Local\Programs\Python\Python311\Lib\site-packages\gallery_dl\job.py", line 125, in run
    for msg in extractor:
  File "C:\Users\dtbead\\AppData\Local\Programs\Python\Python311\Lib\site-packages\gallery_dl\extractor\twitter.py", line 131, in items
    tdata = self._transform_tweet(tweet)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\dtbead\\AppData\Local\Programs\Python\Python311\Lib\site-packages\gallery_dl\extractor\twitter.py", line 648, in _transform_tweet
    (int(tweet["sortIndex"]) >> 20) // 1000)
     ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

config

{
	"extractor": {
		"archive": "archive.sqlite3",
		"skip": "abort:5",
		"directory": [
			"{category}"
		],
		"twitter": {
			"cards": "true",
			"expand": "false",
			"tweet-endpoint": "restid",
			"logout": "true",
			"replies": "self",
			"twitpic": "true"
		}
	},
	"cache": "cache.sqlite3"
}
@mikf mikf added the site:bug label Sep 4, 2023
@mikf
Copy link
Owner

mikf commented Sep 4, 2023

The issue here is "expand": "false". This enables the expand option since it is set to a non-empty string. It would need to be "expand": false without quotes to explicitly disable it.

This exception should still be fixed, though.

@dtbead
Copy link
Author

dtbead commented Sep 4, 2023

The issue here is "expand": "false". This enables the expand option since it is set to a non-empty string. It would need to be "expand": false without quotes to explicitly disable it.

that fixed it for me
thanks

@dtbead dtbead closed this as completed Sep 4, 2023
@dtbead dtbead reopened this Sep 4, 2023
@mikf mikf added the config label Sep 5, 2023
@mikf mikf closed this as completed Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants