|
@@ -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": 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 }) => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -106,22 +102,50 @@ const TwitterLikeAPI = ({ info, data }) => {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
+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
|
|
|
}
|