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

Instagram: DirectoryFormatError: Applying directory format string failed (TypeError: unsupported format string passed to NoneType.__format__) #2830

Closed
arisboch opened this issue Aug 14, 2022 · 4 comments

Comments

@arisboch
Copy link

Today, the program suddenly wouldn't download any Instagram post, but give me this error message instead:

[gallery-dl][debug] Version 1.23.0-dev
[gallery-dl][debug] Python 3.10.4 - Linux-5.15.0-46-generic-x86_64-with-glibc2.35
[gallery-dl][debug] requests 2.28.1 - urllib3 1.26.11
[gallery-dl][debug] Starting DownloadJob for 'https://www.instagram.com/p/ChKXmZXBjhl/'
[instagram][debug] Using InstagramPostExtractor for 'https://www.instagram.com/p/ChKXmZXBjhl/'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): i.instagram.com:443
[urllib3.connectionpool][debug] https://i.instagram.com:443 "GET /api/v1/media/2903236703433406565/info/ HTTP/1.1" 200 4573
[instagram][error] DirectoryFormatError: Applying directory format string failed (TypeError: unsupported format string passed to NoneType.__format__)

Especially the last line is weird, because I never had these kinda issues with Instagram post downloads, but here's the relevant part of the config file:

    "instagram":
 	 {
		"directory": ["instagram {username} {date:%Y.%m.%d %H_%M_%S} {post_shortcode}"],
		"filename": "instagram {username} {date:%Y.%m.%d %H_%M_%S} {post_shortcode} {num}.{extension}",
		"sleep": 2,
		"cookies":
		{
			"sessionid": "[redacted]",
			"mid"      : "[redacted]",
			"csrftoken": "[redacted]"
		}

The directory format string doesn't look too weird and in fact, as I mentioned earlier, worked without problems before, so what could be the problem here?

@mikf
Copy link
Owner

mikf commented Aug 14, 2022

suddenly

I think it happened because you updated gallery-dl and it is now using a different API endpoint for IG posts and does not provide a date field for directory format strings.

@arisboch
Copy link
Author

Would it be possible for you to re-add it (or at least suggest a work-around of some sorts)?

@mikf
Copy link
Owner

mikf commented Aug 14, 2022

This should do the trick, at least for single posts: 391aecf

@arisboch
Copy link
Author

arisboch commented Aug 14, 2022

Thanks, it works!

@mikf mikf closed this as completed Aug 16, 2022
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