From 3888e6781c0ffdfa333e96dd4bd16f8752f83e48 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 20:34:18 +0000 Subject: [PATCH] style: auto format --- docs/social-media.md | 1 - lib/v2/twitter/web-api/twitter-api.js | 30 ++++++++++++++------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/docs/social-media.md b/docs/social-media.md index b2fe235f5d..79a98c0ffa 100644 --- a/docs/social-media.md +++ b/docs/social-media.md @@ -872,7 +872,6 @@ Instagram Stories 没有可靠的 guid,你的 RSS 阅读器可能将同一条 - ## Vimeo ### 用户页面 diff --git a/lib/v2/twitter/web-api/twitter-api.js b/lib/v2/twitter/web-api/twitter-api.js index e7adb2b769..ac7bbb5164 100644 --- a/lib/v2/twitter/web-api/twitter-api.js +++ b/lib/v2/twitter/web-api/twitter-api.js @@ -113,13 +113,18 @@ const timelineKeywords = (keywords, params = {}) => // https://github.com/mikf/gallery-dl/blob/a53cfc845e12d9e98fefd07e43ebffaec488c18f/gallery_dl/extractor/twitter.py#L795-L805 const tweetDetail = (userId, params) => - paginationTweets('/graphql/ItejhtHVxU7ksltgMmyaLA/TweetDetail', userId, { - ...params, - with_rux_injections: false, - withCommunity: true, - withQuickPromoteEligibilityTweetFields: false, - withBirdwatchNotes: false, - }, ["threaded_conversation_with_injections"]); + paginationTweets( + '/graphql/ItejhtHVxU7ksltgMmyaLA/TweetDetail', + userId, + { + ...params, + with_rux_injections: false, + withCommunity: true, + withQuickPromoteEligibilityTweetFields: false, + withBirdwatchNotes: false, + }, + ['threaded_conversation_with_injections'] + ); function gatherLegacyFromData(entries, filter = 'tweet-') { const tweets = []; @@ -128,14 +133,12 @@ function gatherLegacyFromData(entries, filter = 'tweet-') { const entryId = entry.entryId; if (entryId) { if (filter === 'none') { - if (entryId.startsWith("tweet-")) { + if (entryId.startsWith('tweet-')) { filte_entries.push(entry); - } - else if (entryId.startsWith("homeConversation-") || entryId.startsWith("conversationthread-")) { + } else if (entryId.startsWith('homeConversation-') || entryId.startsWith('conversationthread-')) { filte_entries.push(...entry.content.items); } - } - else { + } else { if (entryId.startsWith(filter)) { filte_entries.push(entry); } @@ -148,7 +151,7 @@ function gatherLegacyFromData(entries, filter = 'tweet-') { let tweet = content?.itemContent?.tweet_results?.result; if (tweet && tweet.tweet) { tweet = tweet.tweet; - }; + } if (tweet) { const retweet = tweet.legacy?.retweeted_status_result?.result; for (const t of [tweet, retweet]) { @@ -210,7 +213,6 @@ const getUserMediaByID = async (id, params = {}) => gatherLegacyFromData(await t const getUserLikesByID = async (id, params = {}) => gatherLegacyFromData(await timelineLikes(id, params)); const getUserTweetByStatus = async (id, params = {}) => gatherLegacyFromData(await tweetDetail(id, params), 'none'); - const excludeRetweet = function (tweets) { const excluded = []; for (const t of tweets) {