twikit icon indicating copy to clipboard operation
twikit copied to clipboard

get_trends is deprecated

Open touchmeangel opened this issue 3 months ago • 0 comments

Issue: get_trends always returns 404 / empty list

Description

The following code (simplified):

client = Client('en-US')
client.set_cookies({"auth_token": auth.auth_token, "ct0": auth.ct0})

try:
    trends = await client.get_trends("trending", count=40, retry=False)
except errors.Forbidden:
    raise RuntimeError("Authentication required: AUTH_REQUIRED")

always returns an empty list ([]). The root cause appears to be that the current version of twikit still uses an outdated API via guild.json.

Fix: touchmeangel/twikit When running the same code against that fork, the output is:

[
  <Trend name="#Coinbase">,
  <Trend name="Fully Homomorphic Encryption">,
  <Trend name="Airdrop">,
  <Trend name="BlackRock">,
  <Trend name="#Traderumour">,
  <Trend name="CAT 1">
]

How to fix?

  • Update the upstream twikit to incorporate the GenericTimelineById fixes from the fork.
  • Deprecate the use of guild.json in favor of the modern endpoint implementation.
  • Add a regression test to ensure that get_trends("trending", …) returns valid trend data under authenticated sessions.

touchmeangel avatar Oct 04 '25 08:10 touchmeangel