|
@@ -3,60 +3,55 @@ import { getCookie } from '@/uilts/help'
|
|
|
|
|
|
|
|
|
const TwitterApiCreateTweet = ({ info, data }) => {
|
|
|
- // let params = {
|
|
|
- // 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
|
|
|
- // },
|
|
|
- // 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
|
|
|
- // }
|
|
|
- // };
|
|
|
- // axios.post(`https://twitter.com/i/api/graphql/hC1nuE-2d1NX5LYBuuAvtQ/CreateTweet`,
|
|
|
- // params, {
|
|
|
- // 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) {
|
|
|
- // data.response = response
|
|
|
-
|
|
|
- // messageCenter.send({ info, data: response })
|
|
|
- // messageCenter.send({ id: data.iframeId, actionType, data: response })
|
|
|
- // chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet1', task_data: '', task_done: '是', response, iframeId })
|
|
|
- // }).catch(function (err) {
|
|
|
- // messageCenter.send({ id: data.iframeId, actionType, data: err })
|
|
|
- // // chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'createTweet1', task_data: '', task_done: '否', iframeId })
|
|
|
- // });
|
|
|
+ let params = {
|
|
|
+ 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
|
|
|
+ },
|
|
|
+ variables: {
|
|
|
+ "tweet_text": data.txt,
|
|
|
+ "media": {
|
|
|
+ "media_entities": [],
|
|
|
+ "possibly_sensitive": false
|
|
|
+ },
|
|
|
+ "withDownvotePerspective": true,
|
|
|
+ "withReactionsMetadata": false,
|
|
|
+ "withReactionsPerspective": false,
|
|
|
+ "withSuperFollowsTweetFields": true,
|
|
|
+ "withSuperFollowsUserFields": true,
|
|
|
+ "semantic_annotation_ids": [],
|
|
|
+ "dark_request": false
|
|
|
+ }
|
|
|
+ };
|
|
|
+ axios.post(`https://twitter.com/i/api/graphql/hC1nuE-2d1NX5LYBuuAvtQ/CreateTweet`,
|
|
|
+ params, {
|
|
|
+ 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) {
|
|
|
+ messageCenter.send({ info, data: response })
|
|
|
+ }).catch(function (err) {
|
|
|
+ messageCenter.send({ info, data: err })
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
const TwitterLikeAPI = ({ info, data }) => {
|
|
@@ -91,7 +86,8 @@ const TwitterLikeAPI = ({ info, data }) => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-// const TwitterFollowAPI = (item, tweet_Id) => {
|
|
|
+// const TwitterFollowAPI = ({ info, data }) => {
|
|
|
+// //
|
|
|
// fetch("https://twitter.com/i/api/1.1/friendships/create.json", {
|
|
|
// "headers": {
|
|
|
// "authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA",
|
|
@@ -106,22 +102,50 @@ const TwitterLikeAPI = ({ info, data }) => {
|
|
|
// },
|
|
|
// "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 + "",
|
|
|
+// "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=" + data.follow_name + "",
|
|
|
// "method": "POST",
|
|
|
// "mode": "cors",
|
|
|
// "credentials": "include"
|
|
|
// }).then(() => {
|
|
|
-// let task_data = {
|
|
|
-// follow_name: item.name
|
|
|
-// }
|
|
|
-// chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'follow', task_data, task_done: true }, () => { })
|
|
|
-// messageCenter.send({ id: data.iframeId, actionType, data: '123' })
|
|
|
+// messageCenter.send({ info, data: { task_done: true, follow_name: data.follow_name } })
|
|
|
// }).catch(() => {
|
|
|
-// console.log('DO_TASK3')
|
|
|
-// chrome.runtime.sendMessage({ actionType: "DO_TASK", do_type: 'api', tweet_Id, task_type: 'follow', task_data, task_done: false }, () => { })
|
|
|
+// messageCenter.send({ info, data: { task_done: false, follow_name: data.follow_name } })
|
|
|
// })
|
|
|
// }
|
|
|
|
|
|
+const TwitterRetweetAPI = ({ info, data }) => {
|
|
|
+ fetch("https://twitter.com/i/api/graphql/ojPdsZsimiJrUGLR1sjUtA/CreateRetweet", {
|
|
|
+ "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\":\"" + data.tweetId + "\",\"dark_request\":false},\"queryId\":\"ojPdsZsimiJrUGLR1sjUtA\"}",
|
|
|
+ "method": "POST",
|
|
|
+ "mode": "cors",
|
|
|
+ "credentials": "include"
|
|
|
+ }).then(() => {
|
|
|
+ messageCenter.send({ info, data: { task_done: true } })
|
|
|
+ }).catch(() => {
|
|
|
+ messageCenter.send({ info, data: { task_done: false } })
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
export default {
|
|
|
- TwitterApiCreateTweet, TwitterLikeAPI
|
|
|
+ TwitterApiCreateTweet,
|
|
|
+ TwitterLikeAPI,
|
|
|
+ TwitterRetweetAPI
|
|
|
}
|