Get X trending topics
Input
tab optionalWhich Explore tab to read. These are X's own tabs and map to its own route segments (/explore/tabs/<tab>), which are locale-invariant even though the visible tab labels are translated. The tabs differ in row shape and the script handles both: "trending" returns ranked topics (rank + "Music · Trending" + name), while news, sports and entertainment return headline stories (headline + "9 hours ago · Other · 195K posts"). "for_you" mixes the two shapes in one list, so expect some rows with a rank and some without.
Default: "trending"limit optionalMaximum entries to return, in the order X ranks them. The trending tab renders about 30 without scrolling and the topical tabs far fewer — sports returned only 5 — so asking for more scrolls until the list stops growing and simply returns what the tab holds.
Default: 20Output
tab requiredurl requiredThe Explore tab URL actually read.
count requiredtrends requirednote optionalSet when a tab rendered no rows at all — normal for for_you, which is a timeline rather than a list.
