On twitter/X website, the tweets with long text get cut and you have to press “view more” to view the whole tweet.
but after inspecting the HTTP call that get the tweet data, I saw that the response has the whole tweet text in result.note_tweet.text instead of result.full_text which has the short text.
so after inspecting the code that displays the tweet I found this line.
y.text = y.full_text || y.text || ""
so I want to make a userscript to replace this line with result.note_tweet.text but the problem is that this line of code is inside a function inside a webpack module
147093: (e, n, d) => {
"use strict";
d.d(n, {
Z: () => h
});
var t = d(824797)
, r = d(210023)
, a = d(246685)
, o = d(546395)
, l = d(92174);
const i = e => e.reduce(( (e, n) => {
const {indices: d} = n;
return e.some((e => e.url === n.url && e.id_str === n.id_str && e.indices?.[0] === d?.[0])) ? e : e.concat(n)
}
), [])
, s = /^(.*codecs=)([^";]+)(.*)$/
, u = e => {
const n = {
...e,
sensitive_media_warning: e.sensitive_media_warning || e.ext_sensitive_media_warning,
mediaStats: e.mediaStats || e.ext?.mediaStats?.r?.ok
}
, d = (e => {
if (e.video_info)
return e.video_info.variants.map((e => {
return {
...e,
content_type: (n = e.content_type,
s.test(n) ? n.replace(s, ( (e, n, d, t) => ${n}"${d}"${t})) : n)
};
var n
}
))
}
)(n);
return d && (n.video_info.variants = d),
n
}
, c = (e=[]) => e.map((e => {
return "photo" === e.type ? (n = e,
{
...n,
sensitive_media_warning: n.sensitive_media_warning || n.ext_sensitive_media_warning
}) : u(e);
var n
}
))
, b = e => e.initial ? e.initial : e.edit?.edit_control_initial ? {
initial_tweet_id: e.edit.initial_tweet_id,
edit_tweet_ids: e.edit.edit_control_initial.edit_tweet_ids,
editable_until_msecs: e.edit.edit_control_initial.editable_until_msecs,
is_edit_eligible: e.edit.edit_control_initial.is_edit_eligible,
edits_remaining: e.edit.edit_control_initial.edits_remaining
} : void 0;
function h(e, n, d) {
const {created_at: s, ext_edit_control: u, ext_has_birdwatch_notes: h, ext_limited_action_results: m, ext_views: p, extended_entities: A, in_reply_to_screen_name: D, in_reply_to_user_id_str: g, quoted_status_id_str: w, retweeted_status_id_str: M, user_id_str: _, ...S} = (0,
o.Z)(e, n, d)
, y = {
...S
}
, {article: f, birdwatch_pivot: k, entities: v, ext: T, ext_trusted_friends_metadata: C, full_text: P, grok_analysis_followups: R, has_birdwatch_notes: E, id_str: I, trend_id: B, withheld_entities: x, withheld_text: G} = e;
G && (y.text = G,
y.full_text = G,
y.entities = x || {},
y.withheld_text = P,
y.withheld_entities = v),
B && (y.trend_id = B),
R && (y.grok_analysis_followups = R),
A && (y.extended_entities = {
...A,
media: c(A?.media)
}),
T?.voiceInfo?.r?.ok && (y.voiceInfo = T?.voiceInfo?.r?.ok,
delete T?.voiceInfo),
m && (y.limited_action_results = m.limited_actions.map((e => {
const {limited_action_type: d, prompt: t} = e
, o = t?.cta_limited_action_prompt || t?.basic_limited_action_prompt
, l = (0,
a.Z)(o, n)
, i = r.hd[d];
return i && {
action: i,
prompt: l
}
}
)).filter((e => e))),
y.text = y.full_text || y.text || "",//*************************
And I tried so many ways to override the function but none worked.
so is there a way to inject this line into the module or is it impossible?