get_trends not working with 'news' and 'sports' categories #287
Description
I've been trying to use twikit to get trends from X, but the get_trends function doesn't work when I use 'news' or 'sports' as my category ('trending,' 'for-you,' and 'entertainment' work fine). Below is the error code from trying to use news:
Traceback (most recent call last):
File "/Users/ericge/Code/Coscribe-AI/x_scraper.py", line 23, in
result = asyncio.run(scrape_x(username, email, password, topic))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/ericge/Code/Coscribe-AI/x_scraper.py", line 10, in scrape_x
results = await cl.get_trends(category='news', count=10)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/twikit/client/client.py", line 2589, in get_trends
trend_info = item['item']['content']['trend']
~~~~~~~^^^^^^^^^
KeyError: 'trend'