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 image size/filetype question #1881

Closed
lordboosto opened this issue Sep 22, 2021 · 9 comments
Closed

Twitter image size/filetype question #1881

lordboosto opened this issue Sep 22, 2021 · 9 comments

Comments

@lordboosto
Copy link

Was wondering if the extractor can be somehow edited to pick and choose the filetype and the image size.
by default it seems to just download whatever the image automatically opens too i.e
image
a link that looks like this
but you can change the format from jpg to png and you can change the filesize to the maximum that twitter handles (4096x4096) to get the actual original size of the image like this
image

@nisehime
Copy link

nisehime commented Sep 22, 2021

Afaik, gallery-dl tries to get the orig link first (https://pbs.twimg.com/media/E_zcRmmVEAEd7gb?format=jpg&name=orig) and falls back to lower size if getting orig failed, but you would be notified about that in the log. I guess there's no difference between 4096x4096 and orig.

Unfortunately, png format doesn't seem to work with max image size. Your link gives me 504 error, and replacing it with orig is just empty page. But it can be used with large and other sizes during fallback.

I'm not sure that png twitter returns would always be true png and not just jpg in png format though.

UPD: Turns out 504 error is not related to this, for some reasons I started to get it randomly for direct twitter image links since yesterday. After some time the image loads fine. So yeah, using format=png with name=4096x4096 actually works. But the problem still remains it looks like using format=png doesn't mean the image is true png.

@AlttiRi
Copy link

AlttiRi commented Sep 23, 2021

@mikf, 4096x4096 (with format=png (Optionally? In some cases it's required.)) should be used as a fallback URL for 504 errors.

It looks to be fully (binary) identical to orig (with the same format), but it allows to pass the 504 error.


BTW, it's possible to not use the fallback URL with the lower resolution/quality at all?

@AlttiRi
Copy link

AlttiRi commented Sep 23, 2021

But format=png&name=4096x4096 images take much more space.*

An old image that was downloaded before is ~3 MB, now I can redownload it only with format=png&name=4096x4096, but the png image is ~10 MB, while both pictures are pixel-identical.

Currently even the Twitter's front end faces with "An error occurred loading this image" error when I expand such image.

*format=jpg&name=4096x4096 is the same as format=jpg&name=orig

@AlttiRi
Copy link

AlttiRi commented Sep 23, 2021

I just tested my userscript in Firefox and I found that all URLs work fine in Firefox (with the plain old format=jpg&name=orig), while in Chromium do not.
However Firefox' cookies do not help gallery-dl to download that images.

UPD. It stopped to work too. But in Firefox I get 503 error (Service Unavailable), not 504 (Gateway Timeout).

UPD2. It started to work in Chrome. And in gallery-dl. everywhere.

Well, it's probably was a "some" Twitter's experiment in production.

UPD3. Although with gallery-dl I still face 504 error (the same URL opens fine in a browser (with disabled cache)).
Okay, just leave it as is for a time.

UPD4. I have finally downloaded all files without any error with gallery-dl.

@nisehime
Copy link

4096x4096 (with format=png (Optionally? In some cases it's required.)) should be used as a fallback URL for 504 errors.

Yeah, I wanted to suggest that too. So far there are 3 types of links to get max sized image:
https://pbs.twimg.com/media/E_zcRmmVEAEd7gb?format=jpg&name=orig
https://pbs.twimg.com/media/E_zcRmmVEAEd7gb?format=jpg&name=4096x4096
https://pbs.twimg.com/media/E_zcRmmVEAEd7gb.jpg:orig

I think they can be used as fallback urls before getting lower sized ones.

BTW, it's possible to not use the fallback URL with the lower resolution/quality at all?

extractor.*.fallback

but the png image is ~10 MB, while both pictures are pixel-identical

That's what I was saying. Probably doesn't worth it.

@dawidmosk
Copy link

Afaik, gallery-dl tries to get the orig link first (https://pbs.twimg.com/media/E_zcRmmVEAEd7gb?format=jpg&name=orig) and falls back to lower size if getting orig failed, but you would be notified about that in the log. I guess there's no difference between 4096x4096 and orig.

Unfortunately, png format doesn't seem to work with max image size. Your link gives me 504 error, and replacing it with orig is just empty page. But it can be used with large and other sizes during fallback.

I'm not sure that png twitter returns would always be true png and not just jpg in png format though.

UPD: Turns out 504 error is not related to this, for some reasons I started to get it randomly for direct twitter image links since yesterday. After some time the image loads fine. So yeah, using format=png with name=4096x4096 actually works. But the problem still remains it looks like using format=png doesn't mean the image is true png.

There is different - on start i was thinking same but after i got x5000 size. Thank you for helping me downlaod best wallpaper :-)

@nisehime
Copy link

nisehime commented Oct 9, 2022

What exactly different? 4096x4096 and orig are not the same?

@dawidmosk
Copy link

What exactly different? 4096x4096 and orig are not the same?

No, i got 3333x5000 on orig from:
https://pbs.twimg.com/media/FZ1gfpEXEAA8BHa?format=jpg&name=orig
on 4096 is more different.

@nisehime
Copy link

nisehime commented Oct 9, 2022

Ah, I see. Thanks for the info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants