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

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

Open
biggestsonicfan opened this issue Aug 25, 2022 · 12 comments
Open

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

biggestsonicfan opened this issue Aug 25, 2022 · 12 comments
Labels
bug Something isn't working enhancement New feature or request fixed

Comments

@biggestsonicfan
Copy link

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 AlttiRi added the bug Something isn't working label Aug 25, 2022
@AlttiRi
Copy link
Owner

AlttiRi commented Aug 25, 2022

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
Copy link
Owner

AlttiRi commented Aug 25, 2022

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 AlttiRi added enhancement New feature or request and removed bug Something isn't working labels Aug 25, 2022
@AlttiRi
Copy link
Owner

AlttiRi commented Aug 25, 2022

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

@AlttiRi AlttiRi added the bug Something isn't working label Aug 25, 2022
@biggestsonicfan
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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

AlttiRi added a commit that referenced this issue Sep 28, 2022
Unused GraphQL code:

```js
        static async getVideoInfoWithGraphQL(tweetId) {
            const graphQLToken = "AkHczoaCocpQ_XO0hVM_-Q";
            const variables = {
                "focalTweetId": "tweetId.toString()",
                "with_rux_injections": false,
                "includePromotedContent": true,
                "withCommunity": true,
                "withQuickPromoteEligibilityTweetFields": true,
                "withBirdwatchNotes": false,
                "withSuperFollowsUserFields": true,
                "withDownvotePerspective": true,
                "withReactionsMetadata": false,
                "withReactionsPerspective": false,
                "withSuperFollowsTweetFields": true,
                "withVoice": true,
                "withV2Timeline": true
            };
            const features = {
                "responsive_web_graphql_timeline_navigation_enabled": false,
                "unified_cards_ad_metadata_container_dynamic_card_content_query_enabled": true,
                "dont_mention_me_view_api_enabled": true,
                "responsive_web_uc_gql_enabled": true,
                "vibe_api_enabled": true,
                "responsive_web_edit_tweet_api_enabled": true,
                "graphql_is_translatable_rweb_tweet_is_translatable_enabled": false,
                "standardized_nudges_misinfo": true,
                "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false,
                "interactive_text_enabled": true,
                "responsive_web_text_conversations_enabled": false,
                "responsive_web_enhance_cards_enabled": true
            };
            const url = `https://twitter.com/i/api/graphql/${graphQLToken}/TweetDetail?`
                + "variables=" + encodeURIComponent(JSON.stringify(variables)) + "&" +
                + "features=" + encodeURIComponent(JSON.stringify(features));
            const json = await API.apiRequest(url);
            verbose && console.log("[getVideoInfoWithGraphQL]", json);
            return json.data; // todo
        }
```
@AlttiRi
Copy link
Owner

AlttiRi commented Sep 28, 2022

Should be fixed now.

No need to even use GraphQL API.

@AlttiRi AlttiRi closed this as completed Sep 30, 2022
@biggestsonicfan
Copy link
Author

Inverse just happened with the video as the QRT here.

@AlttiRi
Copy link
Owner

AlttiRi commented Oct 29, 2022

Seems to be fixed in 06a13b2.

@biggestsonicfan
Copy link
Author

Seems to be fixed in 06a13b2.

I wish every git repo worked as hard and as fast as you 😆

@AlttiRi
Copy link
Owner

AlttiRi commented Jul 3, 2023

Fixed again. 92de3f2
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
Copy link
Owner

AlttiRi commented Jul 7, 2023

78164e0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request fixed
Projects
None yet
Development

No branches or pull requests

2 participants