mirror of
https://github.com/CompeyDev/fxtwitter-docker.git
synced 2025-04-19 11:24:00 +01:00
Translation workaround
This commit is contained in:
parent
54dc797247
commit
0384e5746e
3 changed files with 9 additions and 4 deletions
|
@ -45,7 +45,7 @@ export const handleStatus = async (
|
||||||
status,
|
status,
|
||||||
fetchWithThreads,
|
fetchWithThreads,
|
||||||
request,
|
request,
|
||||||
undefined,
|
language,
|
||||||
flags?.api ?? false
|
flags?.api ?? false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -272,13 +272,16 @@ export const constructTwitterThread = async (
|
||||||
language: string | undefined,
|
language: string | undefined,
|
||||||
legacyAPI = false
|
legacyAPI = false
|
||||||
): Promise<SocialThread> => {
|
): Promise<SocialThread> => {
|
||||||
console.log('legacyAPI', legacyAPI);
|
console.log('language', language);
|
||||||
|
|
||||||
let response: TweetDetailResult | TweetResultsByRestIdResult | null = null;
|
let response: TweetDetailResult | TweetResultsByRestIdResult | null = null;
|
||||||
let post: APITweet;
|
let post: APITweet;
|
||||||
/* We can use TweetDetail on elongator accounts to increase per-account rate limit.
|
/* We can use TweetDetail on elongator accounts to increase per-account rate limit.
|
||||||
We also use TweetDetail to process threads (WIP) */
|
We also use TweetDetail to process threads (WIP)
|
||||||
if (typeof TwitterProxy !== 'undefined' && (experimentCheck(Experiment.TWEET_DETAIL_API) || processThread)) {
|
|
||||||
|
Also - dirty hack. Right now, TweetDetails requests aren't working with language and I haven't figured out why.
|
||||||
|
I'll figure out why eventually, but for now just don't use TweetDetail for this. */
|
||||||
|
if (typeof TwitterProxy !== 'undefined' && !language && (experimentCheck(Experiment.TWEET_DETAIL_API) || processThread)) {
|
||||||
console.log('Using TweetDetail for request...');
|
console.log('Using TweetDetail for request...');
|
||||||
response = (await fetchTweetDetail(id, request.event)) as TweetDetailResult;
|
response = (await fetchTweetDetail(id, request.event)) as TweetDetailResult;
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,8 @@ export const buildAPITweet = async (
|
||||||
apiTweet.embed_card = 'player';
|
apiTweet.embed_card = 'player';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('language?', language)
|
||||||
|
|
||||||
/* If a language is specified in API or by user, let's try translating it! */
|
/* If a language is specified in API or by user, let's try translating it! */
|
||||||
if (typeof language === 'string' && language.length === 2 && language !== tweet.legacy.lang) {
|
if (typeof language === 'string' && language.length === 2 && language !== tweet.legacy.lang) {
|
||||||
console.log(`Attempting to translate Tweet to ${language}...`);
|
console.log(`Attempting to translate Tweet to ${language}...`);
|
||||||
|
|
Loading…
Add table
Reference in a new issue