mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
11.7k stars 953 forks source link

1.25.8 Twitter doesn't download single tweet. #4307

Closed AAndyProgram closed 1 year ago

AAndyProgram commented 1 year ago

Command

gallery-dl --verbose --cookies "path to cookies" https://twitter.com/name/status/123456789

Version 1.25.8. 1.25.7 works fine.

mikf commented 1 year ago

Works on my machine :tm:

# without login
$ gallery-dl https://twitter.com/kikonoma_tmhmkt/status/1679805434688053248
/tmp/_/twitter/kikonoma_tmhmkt/1679805434688053248_1.jpg
/tmp/_/twitter/kikonoma_tmhmkt/1679805434688053248_2.jpg

# with login
$ gallery-dl -u USERNAME https://twitter.com/kikonoma_tmhmkt/status/1679805434688053248
/tmp/_/twitter/kikonoma_tmhmkt/1679805434688053248_1.jpg
/tmp/_/twitter/kikonoma_tmhmkt/1679805434688053248_2.jpg
mikf commented 1 year ago

I should probably just use the endpoints from https://github.com/mikf/gallery-dl/issues/4300 and make them somehow configurable ...

AAndyProgram commented 1 year ago

Works on my machine ™️

So cookies are no longer accepted? I don't use gallery-dl to download tweets. I'm using it in my program to get json responses. And the authorization to download each profile isn't too much? Maybe there is a way to use cookies instead of login/password?

I should probably just use the endpoints from #4300 and make them somehow configurable ...

I don't understand what argument(s) should I use in the command?

AAndyProgram commented 1 year ago

Without authorization (cookies):

[twitter][info] Requesting guest token
AAndyProgram commented 1 year ago

Have you tested it with nsfw content?

AAndyProgram commented 1 year ago

Works on my machine ™️

# without login
$ gallery-dl https://twitter.com/kikonoma_tmhmkt/status/1679805434688053248
/tmp/_/twitter/kikonoma_tmhmkt/1679805434688053248_1.jpg
/tmp/_/twitter/kikonoma_tmhmkt/1679805434688053248_2.jpg

# with login
$ gallery-dl -u USERNAME https://twitter.com/kikonoma_tmhmkt/status/1679805434688053248
/tmp/_/twitter/kikonoma_tmhmkt/1679805434688053248_1.jpg
/tmp/_/twitter/kikonoma_tmhmkt/1679805434688053248_2.jpg

Confirmed that your example works fine without authorization. NSFW content (video) - no.

mikf commented 1 year ago

So cookies are no longer accepted?

Of course they are still accepted and should work the exact same as a user+pass login.

Have you tested it with nsfw content?

I have to admit that I did not, but it appears to work all the same:

$ gallery-dl -u USERNAME https://twitter.com/mightbecursed/status/1492954264909479936
/tmp/_/twitter/mightbecursed/1492954264909479936_1.jpg

When not logged in it throws an error, though:

$ gallery-dl https://twitter.com/mightbecursed/status/1492954264909479936
[twitter][info] Requesting guest token
[twitter][error] An unexpected error occurred: KeyError - 'core'. ...
mikf commented 1 year ago

Here's a NSFW video with cookies:

$ gallery-dl -C cookies-twitter-com.txt https://twitter.com/theobrobineMale/status/1481233909979684865
/tmp/_/twitter/theobrobineMale/1481233909979684865_1.mp4
mikf commented 1 year ago

With the changes from https://github.com/mikf/gallery-dl/commit/90231f2d5a2fa9ed08c5ed448a45cbe0e5fda12b, it'll use the old endpoint from 1.25.7 and before when logged in and you can choose between new and old API endpoint with the tweet-endpoint option.