|
@@ -1,5 +1,5 @@
|
|
import { getChromeStorage, setChromeStorage, chromeExtensionUrl } from '@/uilts/chromeExtension.js'
|
|
import { getChromeStorage, setChromeStorage, chromeExtensionUrl } from '@/uilts/chromeExtension.js'
|
|
-import { throttle, getQueryString, getCookie, nextTick, getQueryStringByUrl, getStorage, setStorage, getInnerIframeURL, isMobileTwitter } from '@/uilts/help'
|
|
|
|
|
|
+import { throttle, getQueryString, getCookie, nextTick, getQueryStringByUrl, getStorage, setStorage, getInnerIframeURL } from '@/uilts/help'
|
|
import { discordAuthRedirectUri, iframeHost } from '@/http/configAPI'
|
|
import { discordAuthRedirectUri, iframeHost } from '@/http/configAPI'
|
|
import { reportSrcPublishEvent } from '@/http/publishApi'
|
|
import { reportSrcPublishEvent } from '@/http/publishApi'
|
|
|
|
|
|
@@ -1084,49 +1084,6 @@ export function init() {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
-export const getTweetUserFollowStatus = (params) => {
|
|
|
|
- let { tweetId, userList, iframeGUId, type } = JSON.parse(params.data);
|
|
|
|
- let promiseList = [];
|
|
|
|
- for (let i = 0; i < userList.length; i++) {
|
|
|
|
- promiseList[i] = TwitterApiUserByScreenNameReq({ screen_name: userList[i]['name'] });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Promise.allSettled(promiseList).then((res) => {
|
|
|
|
- let list = [];
|
|
|
|
- if (res && res.length) {
|
|
|
|
- let resList = res.filter(item => item.status == 'fulfilled');
|
|
|
|
- for (let i = 0; i < resList.length; i++) {
|
|
|
|
- let item = resList[i];
|
|
|
|
- if (item && item.value && item.value.data && item.value.data.data) {
|
|
|
|
- list.push(item.value.data.data)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- messageCenter.send({
|
|
|
|
- info: {
|
|
|
|
- iframeId: params.iframeId,
|
|
|
|
- actionType: 'CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES'
|
|
|
|
- },
|
|
|
|
- data: {
|
|
|
|
- list, tweetId, type, iframeId: params.iframeId, iframeGUId
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- // chrome.runtime.sendMessage({ actionType: 'CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES', data: list, tweetId, type: params.type, iframeId: params.iframeId }, () => { })
|
|
|
|
- }).catch(err => {
|
|
|
|
- messageCenter.send({
|
|
|
|
- info: {
|
|
|
|
- iframeId: params.iframeId,
|
|
|
|
- actionType: 'CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES'
|
|
|
|
- },
|
|
|
|
- data: {
|
|
|
|
- list: [], tweetId, type, iframeId: params.iframeId, iframeGUId
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- // chrome.runtime.sendMessage({ actionType: 'CONTENT_GET_TWEET_USER_FOLLOW_STATUS_RES', data: [], tweetId, type: params.type, iframeId: params.iframeId }, () => { })
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
function onPageVisbile() {
|
|
function onPageVisbile() {
|
|
document.addEventListener('visibilitychange', function () {
|
|
document.addEventListener('visibilitychange', function () {
|
|
let isHidden = document.hidden;
|
|
let isHidden = document.hidden;
|
|
@@ -1464,79 +1421,7 @@ export function getTweetAuthorByDom(params) {
|
|
iframe.contentWindow.postMessage({ actionType: 'CONTENT_RED_PACKET_GET_TWEET_AUTHOR', data: { fullName } }, '*');
|
|
iframe.contentWindow.postMessage({ actionType: 'CONTENT_RED_PACKET_GET_TWEET_AUTHOR', data: { fullName } }, '*');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
-}
|
|
|
|
-export function doTaskTwitterAPI({ task_data, task_type, tasks, iframeId }) {
|
|
|
|
- switch (task_type) {
|
|
|
|
- case 'like':
|
|
|
|
- TwitterLikeAPI(task_data.tweet_Id)
|
|
|
|
- break
|
|
|
|
- case 'retweet':
|
|
|
|
- TwitterRetweetAPI(task_data.tweet_Id)
|
|
|
|
- break
|
|
|
|
- case 'follow':
|
|
|
|
- task_data.follow_data.forEach((item) => {
|
|
|
|
- if (item.name && item.twitterUserId) {
|
|
|
|
- TwitterFollowAPI(item, task_data.tweet_Id)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- break
|
|
|
|
- case 'tasks':
|
|
|
|
- tasks.forEach((item) => {
|
|
|
|
- //
|
|
|
|
- switch (String(item.type)) {
|
|
|
|
- // 关注指定用户
|
|
|
|
- case '1':
|
|
|
|
- item.relatedUsers.forEach((item) => {
|
|
|
|
- if (item.name && item.twitterUserId) {
|
|
|
|
- TwitterFollowAPI(item, task_data.tweet_Id);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- break
|
|
|
|
- // 点赞
|
|
|
|
- case '2':
|
|
|
|
- TwitterLikeAPI(task_data.tweet_Id)
|
|
|
|
- break
|
|
|
|
-
|
|
|
|
- // 推文发推
|
|
|
|
- case '10':
|
|
|
|
- // 发推
|
|
|
|
- TwitterApiCreateTweet({ text: task_data.tweet_text, tweet_Id: task_data.tweet_Id, iframeId })
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- })
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-export function doTaskIframeTwitterAPI(params) {
|
|
|
|
- let { tweet_Id, tweet_text, task_type, tasks, iframeGUId } = JSON.parse(params.data);
|
|
|
|
- if (task_type == 'tasks') {
|
|
|
|
- tasks.forEach((item) => {
|
|
|
|
- switch (String(item.type)) {
|
|
|
|
- // 关注指定用户
|
|
|
|
- case '1':
|
|
|
|
- item.relatedUsers.forEach((item) => {
|
|
|
|
- if (item.name && item.twitterUserId) {
|
|
|
|
- TwitterFollowAPI(item, tweet_Id);
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- break
|
|
|
|
- // 点赞
|
|
|
|
- case '2':
|
|
|
|
- TwitterLikeAPI(tweet_Id)
|
|
|
|
- break
|
|
|
|
- // 推文发推
|
|
|
|
- case '10':
|
|
|
|
- // 发推
|
|
|
|
- TwitterApiCreateTweet({ text: tweet_text, tweet_Id, iframeId: params.iframeId, iframeGUId, iframeMsg: true })
|
|
|
|
- break
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- } else if (task_type == 'like') {
|
|
|
|
- TwitterLikeAPI(tweet_Id)
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
export function showJoinDialog(data) {
|
|
export function showJoinDialog(data) {
|
|
@@ -1546,292 +1431,6 @@ export function showJoinDialog(data) {
|
|
iframe.src = chromeExtensionUrl + (`iframe/buy-nft.html#/group?params=${JSON.stringify(data)}&time=${new Date().getTime()}`)
|
|
iframe.src = chromeExtensionUrl + (`iframe/buy-nft.html#/group?params=${JSON.stringify(data)}&time=${new Date().getTime()}`)
|
|
}
|
|
}
|
|
|
|
|
|
-const TwitterFriendshipsUpdate = (params) => {
|
|
|
|
- let { id = '', device = true, name } = params || {};
|
|
|
|
- let data = {
|
|
|
|
- include_profile_interstitial_type: 1,
|
|
|
|
- include_blocking: 1,
|
|
|
|
- include_blocked_by: 1,
|
|
|
|
- include_followed_by: 1,
|
|
|
|
- include_want_retweets: 1,
|
|
|
|
- include_mute_edge: 1,
|
|
|
|
- include_can_dm: 1,
|
|
|
|
- include_can_media_tag: 1,
|
|
|
|
- include_ext_has_nft_avatar: 1,
|
|
|
|
- skip_status: 1,
|
|
|
|
- cursor: -1,
|
|
|
|
- id,
|
|
|
|
- device
|
|
|
|
- }
|
|
|
|
- if (!id) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- let url = isMobileTwitter() ? 'https://mobile.twitter.com/i/api/1.1/friendships/update.json' : "https://twitter.com/i/api/1.1/friendships/update.json";
|
|
|
|
- return fetch(url, {
|
|
|
|
- "headers": {
|
|
|
|
- "authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA",
|
|
|
|
- "content-type": "application/x-www-form-urlencoded",
|
|
|
|
- "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"102\", \"Google Chrome\";v=\"102\"",
|
|
|
|
- "sec-ch-ua-mobile": "?0",
|
|
|
|
- "sec-ch-ua-platform": "\"macOS\"",
|
|
|
|
- "x-csrf-token": getCookie('ct0'),
|
|
|
|
- "x-twitter-active-user": "yes",
|
|
|
|
- "x-twitter-auth-type": "OAuth2Session",
|
|
|
|
- "x-twitter-client-language": "en",
|
|
|
|
- "referer": `https://twitter.com/${name}`
|
|
|
|
- },
|
|
|
|
- "referrer": `https://twitter.com/${name}`,
|
|
|
|
- "referrerPolicy": "strict-origin-when-cross-origin",
|
|
|
|
- "body": `include_profile_interstitial_type=1&include_blocking=1&include_blocked_by=1&include_followed_by=1&include_want_retweets=1&include_mute_edge=1&include_can_dm=1&include_can_media_tag=1&include_ext_has_nft_avatar=1&skip_status=1&cursor=-1&id=${id}&device=true`,
|
|
|
|
- "method": "POST",
|
|
|
|
- "mode": "cors",
|
|
|
|
- "credentials": "include"
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const TwitterFollowAPI = (item, tweet_Id) => {
|
|
|
|
- let url = isMobileTwitter() ? "https://mobile.twitter.com/i/api/1.1/friendships/create.json" : "https://twitter.com/i/api/1.1/friendships/create.json"
|
|
|
|
- fetch(url, {
|
|
|
|
- "headers": {
|
|
|
|
- "authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA",
|
|
|
|
- "content-type": "application/x-www-form-urlencoded",
|
|
|
|
- "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"102\", \"Google Chrome\";v=\"102\"",
|
|
|
|
- "sec-ch-ua-mobile": "?0",
|
|
|
|
- "sec-ch-ua-platform": "\"macOS\"",
|
|
|
|
- "x-csrf-token": getCookie('ct0'),
|
|
|
|
- "x-twitter-active-user": "yes",
|
|
|
|
- "x-twitter-auth-type": "OAuth2Session",
|
|
|
|
- "x-twitter-client-language": "zh-cn"
|
|
|
|
- },
|
|
|
|
- "referrer": "https://twitter.com/home",
|
|
|
|
- "referrerPolicy": "strict-origin-when-cross-origin",
|
|
|
|
- "body": "include_profile_interstitial_type=1&include_blocking=1&include_blocked_by=1&include_followed_by=1&include_want_retweets=1&include_mute_edge=1&include_can_dm=1&include_can_media_tag=1&include_ext_has_nft_avatar=1&skip_status=1&user_id=" + item.twitterUserId + "",
|
|
|
|
- "method": "POST",
|
|
|
|
- "mode": "cors",
|
|
|
|
- "credentials": "include"
|
|
|
|
- }).then(() => {
|
|
|
|
- let task_data = {
|
|
|
|
- follow_name: item.name
|
|
|
|
- }
|
|
|
|
- TwitterFriendshipsUpdate({ id: item.twitterUserId, name: item.name })
|
|
|
|
-
|
|
|
|
- chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'follow', task_data, task_done: true }, () => { })
|
|
|
|
- }).catch(() => {
|
|
|
|
- console.log('DO_TASK3')
|
|
|
|
- chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'follow', task_data, task_done: false }, () => { })
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-const TwitterRetweetAPI = (tweet_Id) => {
|
|
|
|
- let url = isMobileTwitter() ? "https://mobile.twitter.com/i/api/graphql/ojPdsZsimiJrUGLR1sjUtA/CreateRetweet" : "https://twitter.com/i/api/graphql/ojPdsZsimiJrUGLR1sjUtA/CreateRetweet"
|
|
|
|
- fetch(url, {
|
|
|
|
- "headers": {
|
|
|
|
- "accept": "*/*",
|
|
|
|
- "accept-language": "zh,en;q=0.9,zh-CN;q=0.8",
|
|
|
|
- "authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA",
|
|
|
|
- "content-type": "application/json",
|
|
|
|
- "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"102\", \"Google Chrome\";v=\"102\"",
|
|
|
|
- "sec-ch-ua-mobile": "?0",
|
|
|
|
- "sec-ch-ua-platform": "\"macOS\"",
|
|
|
|
- "sec-fetch-dest": "empty",
|
|
|
|
- "sec-fetch-mode": "cors",
|
|
|
|
- "sec-fetch-site": "same-origin",
|
|
|
|
- "x-csrf-token": getCookie('ct0'),
|
|
|
|
- "x-twitter-active-user": "yes",
|
|
|
|
- "x-twitter-auth-type": "OAuth2Session",
|
|
|
|
- "x-twitter-client-language": "zh-cn"
|
|
|
|
- },
|
|
|
|
- "referrer": "https://twitter.com/home",
|
|
|
|
- "referrerPolicy": "strict-origin-when-cross-origin",
|
|
|
|
- "body": "{\"variables\":{\"tweet_id\":\"" + tweet_Id + "\",\"dark_request\":false},\"queryId\":\"ojPdsZsimiJrUGLR1sjUtA\"}",
|
|
|
|
- "method": "POST",
|
|
|
|
- "mode": "cors",
|
|
|
|
- "credentials": "include"
|
|
|
|
- }).then(() => {
|
|
|
|
- chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'retweet', task_data: '', task_done: true }, () => { })
|
|
|
|
- }).catch(() => {
|
|
|
|
- console.log('DO0_TASK4')
|
|
|
|
- chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'retweet', task_data: '', task_done: false }, () => { })
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const TwitterLikeAPI = (tweet_Id) => {
|
|
|
|
- let url = isMobileTwitter() ? "https://mobile.twitter.com/i/api/graphql/lI07N6Otwv1PhnEgXILM7A/FavoriteTweet" : "https://twitter.com/i/api/graphql/lI07N6Otwv1PhnEgXILM7A/FavoriteTweet"
|
|
|
|
- fetch(url, {
|
|
|
|
- "headers": {
|
|
|
|
- "accept": "*/*",
|
|
|
|
- "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
|
|
|
|
- "authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA",
|
|
|
|
- "content-type": "application/json",
|
|
|
|
- "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"101\", \"Google Chrome\";v=\"101\"",
|
|
|
|
- "sec-ch-ua-mobile": "?0",
|
|
|
|
- "sec-ch-ua-platform": "\"Windows\"",
|
|
|
|
- "sec-fetch-dest": "empty",
|
|
|
|
- "sec-fetch-mode": "cors",
|
|
|
|
- "sec-fetch-site": "same-origin",
|
|
|
|
- "x-csrf-token": getCookie('ct0'),
|
|
|
|
- "x-twitter-active-user": "yes",
|
|
|
|
- "x-twitter-auth-type": "OAuth2Session",
|
|
|
|
- "x-twitter-client-language": "en"
|
|
|
|
- },
|
|
|
|
- "referrer": "https://twitter.com/home",
|
|
|
|
- "referrerPolicy": "strict-origin-when-cross-origin",
|
|
|
|
- "body": "{\"variables\":{\"tweet_id\":\"" + tweet_Id + "\"},\"queryId\":\"lI07N6Otwv1PhnEgXILM7A\"}",
|
|
|
|
- "method": "POST",
|
|
|
|
- "mode": "cors",
|
|
|
|
- "credentials": "include"
|
|
|
|
- }).then(() => {
|
|
|
|
- chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'like', task_data: '', task_done: true }, () => { })
|
|
|
|
- }).catch(() => {
|
|
|
|
- console.log('DO_TASK5')
|
|
|
|
- chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'like', task_data: '', task_done: false }, () => { })
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const TwitterApiCreateTweet = ({ text, tweet_Id, iframeId,
|
|
|
|
- iframeGUId, iframeMsg }) => {
|
|
|
|
- let data = {
|
|
|
|
- queryId: "hC1nuE-2d1NX5LYBuuAvtQ",
|
|
|
|
- features: {
|
|
|
|
- "dont_mention_me_view_api_enabled": true,
|
|
|
|
- "interactive_text_enabled": true,
|
|
|
|
- "responsive_web_uc_gql_enabled": false,
|
|
|
|
- "vibe_api_enabled": true,
|
|
|
|
- "responsive_web_edit_tweet_api_enabled": false,
|
|
|
|
- "standardized_nudges_misinfo": true,
|
|
|
|
- "responsive_web_enhance_cards_enabled": false,
|
|
|
|
- "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false,
|
|
|
|
- "responsive_web_text_conversations_enabled": false
|
|
|
|
- },
|
|
|
|
- variables: {
|
|
|
|
- "tweet_text": text,
|
|
|
|
- "media": {
|
|
|
|
- "media_entities": [],
|
|
|
|
- "possibly_sensitive": false
|
|
|
|
- },
|
|
|
|
- "withDownvotePerspective": true,
|
|
|
|
- "withReactionsMetadata": false,
|
|
|
|
- "withReactionsPerspective": false,
|
|
|
|
- "withSuperFollowsTweetFields": true,
|
|
|
|
- "withSuperFollowsUserFields": true,
|
|
|
|
- "semantic_annotation_ids": [],
|
|
|
|
- "dark_request": false
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- let url = isMobileTwitter() ? "https://mobile.twitter.com/i/api/graphql/K9It0MijE2UOlX-8wLyPYA/CreateTweet" : "https://twitter.com/i/api/graphql/hC1nuE-2d1NX5LYBuuAvtQ/CreateTweet"
|
|
|
|
- axios.post(url,
|
|
|
|
- data, {
|
|
|
|
- headers: {
|
|
|
|
- "accept": "*/*",
|
|
|
|
- "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
|
|
|
|
- "authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA",
|
|
|
|
- "content-type": "application/json",
|
|
|
|
- "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"101\", \"Google Chrome\";v=\"101\"",
|
|
|
|
- "sec-ch-ua-mobile": "?0",
|
|
|
|
- "sec-ch-ua-platform": "\"Windows\"",
|
|
|
|
- "sec-fetch-dest": "empty",
|
|
|
|
- "sec-fetch-mode": "cors",
|
|
|
|
- "sec-fetch-site": "same-origin",
|
|
|
|
- "x-csrf-token": getCookie('ct0'),
|
|
|
|
- "x-twitter-active-user": "yes",
|
|
|
|
- "x-twitter-auth-type": "OAuth2Session",
|
|
|
|
- "x-twitter-client-language": "en"
|
|
|
|
- },
|
|
|
|
- }).then(function (response) {
|
|
|
|
- console.log(response)
|
|
|
|
- let data = response.data;
|
|
|
|
- if (iframeMsg) {
|
|
|
|
- messageCenter.send({
|
|
|
|
- info: {
|
|
|
|
- iframeId,
|
|
|
|
- actionType: 'CONTENT_CREATE_TWEET_FINISH'
|
|
|
|
- },
|
|
|
|
- data: {
|
|
|
|
- tweet_Id, iframeId, iframeGUId, response: data, done: true
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet1', task_data: '', task_done: '是', response, iframeId })
|
|
|
|
- }
|
|
|
|
- }).catch(function (err) {
|
|
|
|
- console.log('err --1', err)
|
|
|
|
- if (iframeMsg) {
|
|
|
|
- messageCenter.send({
|
|
|
|
- info: {
|
|
|
|
- iframeId,
|
|
|
|
- actionType: 'CONTENT_CREATE_TWEET_FINISH'
|
|
|
|
- },
|
|
|
|
- data: {
|
|
|
|
- tweet_Id, iframeId, iframeGUId, done: false
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet1', task_data: '', task_done: '否', iframeId })
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const TwitterApiUserByScreenNameReq = (params) => {
|
|
|
|
- let { screen_name } = params || {};
|
|
|
|
- let url = isMobileTwitter() ? `https://mobile.twitter.com/i/api/graphql/gr8Lk09afdgWo7NvzP89iQ/UserByScreenName?variables=%7B%22screen_name%22%3A%22${screen_name}%22%2C%22withSafetyModeUserFields%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%7D` : `https://twitter.com/i/api/graphql/mCbpQvZAw6zu_4PvuAUVVQ/UserByScreenName?variables=%7B%22screen_name%22%3A%22${screen_name}%22%2C%22withSafetyModeUserFields%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%7D`
|
|
|
|
- return axios.get(url, {
|
|
|
|
- headers: {
|
|
|
|
- "accept": "*/*",
|
|
|
|
- "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
|
|
|
|
- "authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA",
|
|
|
|
- "content-type": "application/json",
|
|
|
|
- "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"101\", \"Google Chrome\";v=\"101\"",
|
|
|
|
- "sec-ch-ua-mobile": "?0",
|
|
|
|
- "sec-ch-ua-platform": "\"Windows\"",
|
|
|
|
- "sec-fetch-dest": "empty",
|
|
|
|
- "sec-fetch-mode": "cors",
|
|
|
|
- "sec-fetch-site": "same-origin",
|
|
|
|
- "x-csrf-token": getCookie('ct0'),
|
|
|
|
- "x-twitter-active-user": "yes",
|
|
|
|
- "x-twitter-auth-type": "OAuth2Session",
|
|
|
|
- "x-twitter-client-language": "en"
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-export const TwitterApiUserByScreenName = (params, cb) => {
|
|
|
|
- let { screen_name, tweetId = '', objectType = '', iframeId = '', iframeMsg = false, iframeGUId } = params;
|
|
|
|
-
|
|
|
|
- TwitterApiUserByScreenNameReq({ screen_name }).then(function (response) {
|
|
|
|
- if (iframeMsg) {
|
|
|
|
- messageCenter.send({
|
|
|
|
- info: {
|
|
|
|
- iframeId,
|
|
|
|
- actionType: 'CONTENT_API_GET_TWEET_USER_INFO_END'
|
|
|
|
- },
|
|
|
|
- data: {
|
|
|
|
- iframeGUId, response: response.data.data || {}, objectType
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- chrome.runtime.sendMessage({ actionType: "CONTENT_API_GET_TWEET_USER_INFO_RES", data: response.data.data || {}, tweetId, objectType, iframeId }, () => { })
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }).catch(function (err) {
|
|
|
|
- if (iframeMsg) {
|
|
|
|
- messageCenter.send({
|
|
|
|
- info: {
|
|
|
|
- iframeId,
|
|
|
|
- actionType: 'CONTENT_API_GET_TWEET_USER_INFO_END'
|
|
|
|
- },
|
|
|
|
- data: {
|
|
|
|
- iframeGUId, response: {}, objectType
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- chrome.runtime.sendMessage({ actionType: "CONTENT_API_GET_TWEET_USER_INFO_RES", data: {}, tweetId, objectType, iframeId }, () => { })
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
let click_old_time = new Date().getTime()
|
|
let click_old_time = new Date().getTime()
|
|
export const showTwitterPost = (data) => {
|
|
export const showTwitterPost = (data) => {
|
|
let click_new_time = new Date().getTime()
|
|
let click_new_time = new Date().getTime()
|
|
@@ -2897,11 +2496,4 @@ export const sendContentByTwitterID = (params) => {
|
|
tweet_Id, txt, iframeGUId
|
|
tweet_Id, txt, iframeGUId
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- // 发送
|
|
|
|
- // chrome.runtime.sendMessage({
|
|
|
|
- // actionType: "CONTENT_GET_TWEET_TXT", data: {
|
|
|
|
- // tweet_Id,
|
|
|
|
- // txt
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
}
|
|
}
|