AlttiRi / twitter-click-and-save

[userscript] Adds buttons to save images and videos in Twitter, also does some other enhancements. (Twitter image and video downloader)
https://greasyfork.org/en/scripts/430132
GNU General Public License v3.0
104 stars 9 forks source link

Unable to download video if the video is in a QRT #7

Open biggestsonicfan opened 2 years ago

biggestsonicfan commented 2 years ago

Possibly a result of fixing #4, the media in the QRT of this tweet cannot be downloaded as a video. The image preview, however, downloads fine.

AlttiRi commented 2 years ago

Possibly a result of fixing #4

Possibly no, since in this strange case there is no link (an anchor element <a href="...">) to the embed tweet. So the UJS just uses the parent tweet ID (makes API call with "wrong" ID), so it works like before #4.


Well, however, it does not work also for

image In this case "Aug 19" text contains the URL.

UPD: It this case the video is a "broadcast". It's not a "normal" video.

AlttiRi commented 2 years ago

Okay, the normal video tweet reposts are still downloaded as earlier:

image


Your URL is strange since it does not contain the URL to the embed tweet in HTML, so I can't detect the target (correct) tweet ID.

Hm, why is this retweet so special?

However, if I open the embed tweet by the mouse click, it's just a normal video: image


https://twitter.com/SpaceX/status/1560707309361172480 is a "broadcast" and it can't be download as a usual video.


BTW, gallery-dl and other downloaders also do not support these URLs (as well as adv URLs).

For example, gallery-dl uses a GraphQL Twitter's API, however, even it do not download the URL.


It seems that I need to use an other API(s) for these rare cases.


UPD: It's not a usual retweet, but a "quoted answer": image

AlttiRi commented 2 years ago

Okay, I don't think that it's critical (the userscript still downloads the usual videos and images, in particular, within retweets), so I will try to fix your last two issues some time later.

It seems I just need to use https://twitter.com/i/api/graphql/7i51yEC2i_iurfMKZ8mcNw/TweetDetail endpoint. I'm so lazy to do it, but okay.


Also it seems "broadcast"s do not have a ".mp4" URL, only HLS chunks stream (".m3u8" URL). At least in the https://twitter.com/i/api/1.1/live_video_stream/status/ endpoint that Twitter uses.

image

biggestsonicfan commented 2 years ago

Okay, I don't think that it's critical

I completely agree, these are definitely non-critical things, but are just things I would like to bring to your attention to address functionality of the script. Especially if you were never made aware of them, as was the case with the adv tweet.

I greatly appreciate your time and effort in this script, as I avidly used to right-click tweets, but this has made my life much easier!

biggestsonicfan commented 2 years ago

In perhaps an ironic twist of fate, the ability to save that video is now no longer possible as it has been removed by a copyright takedown. If you have the source information you posted previously saved, you can use that to continue development, else this issue will have to be revisited once a similar tweet is found...

biggestsonicfan commented 2 years ago

Found a new video that won't download as QRT but downloads fine in the original.

AlttiRi commented 2 years ago

Should be fixed now.

No need to even use GraphQL API.

biggestsonicfan commented 2 years ago

Inverse just happened with the video as the QRT here.

AlttiRi commented 2 years ago

Seems to be fixed in https://github.com/AlttiRi/twitter-click-and-save/commit/06a13b2f2c6199b0938d81d16c4a8366dd9dc1e8.

biggestsonicfan commented 2 years ago

Seems to be fixed in 06a13b2.

I wish every git repo worked as hard and as fast as you :laughing:

AlttiRi commented 1 year ago

Fixed again. https://github.com/AlttiRi/twitter-click-and-save/commit/92de3f2c0e24dba63e147c9f3823786d5038d7c2 However, it's seems I need to put into the history both tweet IDs: of the original post and of the quoted post for the correct button color displaying.

AlttiRi commented 1 year ago

https://github.com/AlttiRi/twitter-click-and-save/commit/78164e00485cf0496e0202c58497384f9c2a7741