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

filename from the redirected URL #6944

Open
AlttiRi opened this issue Feb 6, 2025 · 2 comments
Open

filename from the redirected URL #6944

AlttiRi opened this issue Feb 6, 2025 · 2 comments

Comments

@AlttiRi
Copy link

AlttiRi commented Feb 6, 2025

Is it possible to parse filename/ext from the final URL after all redirects?

For example, the mastodon extractor have the follow bug when API sometimes returns a media URL with /media_proxy/ (when I download files from instance b by using instance a (https://a.org/@[email protected])):

urllib3.connectionpool: https://a.org:443 "GET /media_proxy/111222333444555666/original HTTP/11" 302 0
urllib3.connectionpool: https://media.a.org:443 "GET /cache/media_attachments/files/111/222/333/444/555/666/original/a1b2c3d4e5f6.jpg HTTP/11" 200 123456

In this case the filename key is original, while it should be a1b2c3d4e5f6.

@mikf
Copy link
Owner

mikf commented Feb 6, 2025

No, that's (currently) not possible.
The redirect happens at downloader level, which is too late for any proper metadata extraction and handling.

You could give metadata-http a try, but that's a buggy mess.

@AlttiRi
Copy link
Author

AlttiRi commented Feb 7, 2025

gdl_http['filename']/gdl_http[filename] is None with added "metadata-http": "http",.

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