refactor(route/twitter): keep twitter graphql endpoints consistent

This commit is contained in:
pseudoyu
2024-11-29 14:18:20 +08:00
parent 3f12f922bf
commit 3e102d5a53
2 changed files with 3 additions and 7 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import { baseUrl, gqlMap, gqlFeatures, gqlMapThirdParty } from './constants';
import { baseUrl, gqlMap, gqlFeatures } from './constants';
import { config } from '@/config';
import cache from '@/utils/cache';
import { twitterGot, paginationTweets, gatherLegacyFromData } from './utils';
@@ -24,7 +24,7 @@ const getUserData = (id) =>
};
if (config.twitter.thirdPartyApi) {
const endpoint = id.startsWith('+') ? gqlMapThirdParty.UserByRestId : gqlMapThirdParty.UserByScreenName;
const endpoint = id.startsWith('+') ? gqlMap.UserByRestId : gqlMap.UserByScreenName;
return ofetch(`${config.twitter.thirdPartyApi}${endpoint}`, {
method: 'GET',
+1 -5
View File
@@ -15,10 +15,6 @@ const graphQLEndpointsPlain = [
const gqlMap = Object.fromEntries(graphQLEndpointsPlain.map((endpoint) => [endpoint.split('/')[3].replace(/V2$|Query$|QueryV2$/, ''), endpoint]));
const graphQLEndpointsThirdParty = ['/graphql/xxxxxxx/UserByScreenName', '/graphql/xxxxxxx/UserByRestId'];
const gqlMapThirdParty = Object.fromEntries(graphQLEndpointsThirdParty.map((endpoint) => [endpoint.split('/')[3].replace(/V2$|Query$|QueryV2$/, ''), endpoint]));
const gqlFeatureUser = {
hidden_profile_subscriptions_enabled: true,
rweb_tipjar_consumption_enabled: true,
@@ -116,4 +112,4 @@ const timelineParams = {
const bearerToken = 'Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA';
export { baseUrl, gqlMap, gqlMapThirdParty, gqlFeatures, timelineParams, bearerToken };
export { baseUrl, gqlMap, gqlFeatures, timelineParams, bearerToken };