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] invalid format specifier #2920

Closed
afterdelight opened this issue Sep 16, 2022 · 3 comments
Closed

[Twitter] invalid format specifier #2920

afterdelight opened this issue Sep 16, 2022 · 3 comments

Comments

@afterdelight
Copy link

afterdelight commented Sep 16, 2022

command:
gallery-dl https://twitter.com/michelleeeck99/with_replies --verbose

error log:

[twitter][debug] Sleeping for 0.621 seconds
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): cdn.syndication.twimg.com:443
[urllib3.connectionpool][debug] https://cdn.syndication.twimg.com:443 "GET /tweet?id=1354462226791337987 HTTP/1.1" 200 None
[twitter][error] FilenameFormatError: Applying filename format string failed (ValueError: Invalid format specifier)

twitter config:

"directory": {
		""				: ["{user[name]} [{user[id]}]"],
		"retweet_id"              : ["{user[name]} [{user[id]}]", "Retweets"],
                "quote_id"                 : ["{user[name]} [{user[id]}]", "Quoted"],
		"reply_id"			 : ["{user[name]} [{user[id]}]", "Replies"],
		"locals().get('reply_to')": ["{user[name]} [{user[id]}]", "Reply To"]
		},
"filename": {
		""				 : "{date:%Y%m%d}_{tweet_id}_{num}.{extension}",
		"retweet_id"              : "{user[name]}_{date:%Y%m%d}_{tweet_id}_{num}.{extension}", 
		"quote_id"                : "{user[name]}_{date:%Y%m%d}_{tweet_id}_{num}.{extension}",
		"reply_id"			: "{user[name]}_{date:%Y%m%d}_{tweet_id}_{num}.{extension}",
		"locals().get('reply_to')": "{user[name]}_{date:%Y%m%d}_{tweet_id}_{num}.{extension}"
	},

help pls?

@afterdelight
Copy link
Author

afterdelight commented Sep 16, 2022

if I test the problematic link with single link, it worked

command:
gallery-dl https://twitter.com/michelleeeck99/status/1354462226791337987 --verbose --cookies cookies_twitter.txt

log:

[gallery-dl][debug] Version 1.23.1-dev
[gallery-dl][debug] Python 3.10.4 - Windows-10-10.0.19043-SP0
[gallery-dl][debug] requests 2.27.1 - urllib3 1.26.9
[gallery-dl][debug] Starting DownloadJob for 'https://twitter.com/michelleeeck99/status/1354462226791337987'
[twitter][debug] Using TwitterTweetExtractor for 'https://twitter.com/michelleeeck99/status/1354462226791337987'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): twitter.com:443
[urllib3.connectionpool][debug] https://twitter.com:443 "GET /i/api/graphql/ItejhtHVxU7ksltgMmyaLA/TweetDetail?variables=%7B%22focalTweetId%22%3A%221354462226791337987%22%2C%22with_rux_injections%22%3Afalse%2C%22withCommunity%22%3Atrue%2C%22withQuickPromoteEligibilityTweetFields%22%3Atrue%2C%22withBirdwatchNotes%22%3Afalse%2C%22includePromotedContent%22%3Afalse%2C%22withSuperFollowsUserFields%22%3Atrue%2C%22withBirdwatchPivots%22%3Afalse%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Atrue%2C%22withClientEventToken%22%3Afalse%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Afalse%2C%22__fs_interactive_text%22%3Afalse%2C%22__fs_dont_mention_me_view_api_enabled%22%3Afalse%7D HTTP/1.1" 200 2654
[twitter][debug] Active postprocessor modules: [MetadataPP]
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): pbs.twimg.com:443
[urllib3.connectionpool][debug] https://pbs.twimg.com:443 "GET /media/Ess3lH6XAAE9OeG?format=jpg&name=orig HTTP/1.1" 200 127058
* .\michelleeeck99 [2397627511]\Retweets\michelleeeck99_20210127_1354462226791337987_1.jpg

@mikf
Copy link
Owner

mikf commented Sep 17, 2022

This error is due to Tweets from cdn.syndication.twimg.com not having a valid {date}
(it has a value, but that's just a string and not a formattable datetime object).

You are logged in in your second example, so no syndication fallback necessary and {date} gets a proper value.

@afterdelight
Copy link
Author

oh right, i wasnt login before. thanks for the fix!

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