Twitter/X Media Downloader

Save Video/Photo by One-Click.

< Feedback on Twitter/X Media Downloader

Question/comment

§
Posted: 2024-06-05

请求视频详细信息的接口貌似更新了,如果报404可按照下面的思路修改fetchJson部分,在谷歌电脑端简单测试了下可用:

fetchJson: async function(status_id) {
    let base_url = `https: //api.${host}/graphql/Xl5pC_lBk_gcO2ItU39DQw/TweetResultByRestId`;

    let variables = {
        "tweetId": status_id,
        "with_rux_injections": false,
        "includePromotedContent": true,
        "withCommunity": true,
        "withQuickPromoteEligibilityTweetFields": true,
        "withBirdwatchNotes": true,
        "withVoice": true,
        "withV2Timeline": true
    };

    let features = {
        "rweb_lists_timeline_redesign_enabled": true,
        "responsive_web_graphql_exclude_directive_enabled": true,
        "verified_phone_label_enabled": false,
        "creator_subscriptions_tweet_preview_api_enabled": true,
        "responsive_web_graphql_timeline_navigation_enabled": true,
        "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false,
        "tweetypie_unmention_optimization_enabled": true,
        "responsive_web_edit_tweet_api_enabled": true,
        "graphql_is_translatable_rweb_tweet_is_translatable_enabled": true,
        "view_counts_everywhere_api_enabled": true,
        "longform_notetweets_consumption_enabled": true,
        "responsive_web_twitter_article_tweet_consumption_enabled": false,
        "tweet_awards_web_tipping_enabled": false,
        "freedom_of_speech_not_reach_fetch_enabled": true,
        "standardized_nudges_misinfo": true,
        "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": true,
        "longform_notetweets_rich_text_read_enabled": true,
        "longform_notetweets_inline_media_enabled": true,
        "responsive_web_media_download_video_enabled": false,
        "responsive_web_enhance_cards_enabled": false,
        "articles_preview_enabled": false,
        "rweb_video_timestamps_enabled": false,
        "creator_subscriptions_quote_tweet_preview_enabled": false,
        "c9s_tweet_anatomy_moderator_badge_enabled": false,
        "rweb_tipjar_consumption_enabled": false,
        "communities_web_enable_tweet_community_results_fetch": false
    };
    let url = encodeURI(`${base_url}?variables=${JSON.stringify(variables)}&features=${JSON.stringify(features)}`);
    let cookies = this.getCookie();

    let headers = {
        'authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA',
        'x-twitter-active-user': 'yes',
        'x-twitter-client-language': cookies.lang,
        'x-csrf-token': cookies.ct0
    };
    headers['x-guest-token'] = cookies.gt;

    try {
        let tweet_detail = await fetch(url, {
            headers: headers
        }).then(result => result.json());
        let tweet_result = tweet_detail?.data?.tweetResult?.result;

        if (!tweet_result) {
            throw new Error(`Tweet result not found for status ID ${status_id}`);
        }
        return tweet_result;
    } catch (error) {
        console.error("Error fetching tweet JSON:", error);
        throw error;
    }
},
§
Posted: 2024-08-01

不会啊

Post reply

Sign in to post a reply.