Skip to content

Commit

Permalink
fix(twitter)!: 修复Twitter 长文本显示不全 (DIYgod#17596)
Browse files Browse the repository at this point in the history
* Try fix

* apply fix for mobile api
  • Loading branch information
lifegpc authored and artefaritaKuniklo committed Dec 13, 2024
1 parent 3eef12c commit 3880707
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/routes/twitter/api/mobile-api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ function gatherLegacyFromData(entries, filterNested, userId) {
t.legacy.quoted_status = quote.legacy;
t.legacy.quoted_status.user = quote.core.user_result?.result?.legacy || quote.core.user_results?.result?.legacy;
}
if (t.note_tweet) {
const tmp = t.note_tweet.note_tweet_results.result;
t.legacy.entities.hashtags = tmp.entity_set.hashtags;
t.legacy.entities.symbols = tmp.entity_set.symbols;
t.legacy.entities.urls = tmp.entity_set.urls;
t.legacy.entities.user_mentions = tmp.entity_set.user_mentions;
t.legacy.full_text = tmp.text;
}
}
const legacy = tweet.legacy;
if (legacy) {
Expand Down
8 changes: 8 additions & 0 deletions lib/routes/twitter/api/web-api/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,14 @@ export function gatherLegacyFromData(entries: any[], filterNested?: string[], us
t.legacy.quoted_status = quote.legacy;
t.legacy.quoted_status.user = quote.core.user_result?.result?.legacy || quote.core.user_results?.result?.legacy;
}
if (t.note_tweet) {
const tmp = t.note_tweet.note_tweet_results.result;
t.legacy.entities.hashtags = tmp.entity_set.hashtags;
t.legacy.entities.symbols = tmp.entity_set.symbols;
t.legacy.entities.urls = tmp.entity_set.urls;
t.legacy.entities.user_mentions = tmp.entity_set.user_mentions;
t.legacy.full_text = tmp.text;
}
}
const legacy = tweet.legacy;
if (legacy) {
Expand Down

0 comments on commit 3880707

Please sign in to comment.