Skip to content

get_trends is deprecated #389

@touchmeangel

Description

@touchmeangel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions