twikit icon indicating copy to clipboard operation
twikit copied to clipboard

get_trends() easily got KeyError 'trend' when using category other than trending

Open CocoaRush opened this issue 1 year ago • 0 comments

the error: File "/usr/local/lib/python3.10/site-packages/twikit/client.py", line 2582, in get_trends trend_info = item['item']['content']['trend']

I am wondering if some item may not have the key trend, it may need to do a key existing test, and only valid trend_info could be added to results.

CocoaRush avatar May 06 '24 01:05 CocoaRush