Skip to content

Commit

Permalink
fix(route): Twitter list API new query path and support include_rts (#…
Browse files Browse the repository at this point in the history
…16788)

* fix: new Twitter list query path

* feat: support filtering retweets in list api
  • Loading branch information
Rakambda authored Sep 18, 2024
1 parent 42b5362 commit 3eeb7ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/routes/twitter/api/web-api/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const graphQLEndpointsPlain = [
'/graphql/dexO_2tohK86JDudXXG3Yw/UserMedia',
'/graphql/tD8zKvQzwY3kdx5yz6YmOw/UserByRestId',
'/graphql/UN1i3zUiCWa-6r-Uaho4fw/SearchTimeline',
'/graphql/TOTgqavWmxywKv5IbMMK1w/ListLatestTweetsTimeline',
'/graphql/Pa45JvqZuKcW1plybfgBlQ/ListLatestTweetsTimeline',
'/graphql/QuBlQ6SxNAQCt6-kBiCXCQ/TweetDetail',
];

Expand Down
7 changes: 5 additions & 2 deletions lib/routes/twitter/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ export const route: Route = {

async function handler(ctx) {
const id = ctx.req.param('id');
const { count } = utils.parseRouteParams(ctx.req.param('routeParams'));
const { count, include_rts } = utils.parseRouteParams(ctx.req.param('routeParams'));
const params = count ? { count } : {};

await api.init();
const data = await api.getList(id, params);
let data = await api.getList(id, params);
if (!include_rts) {
data = utils.excludeRetweet(data);
}

return {
title: `Twitter List - ${id}`,
Expand Down

0 comments on commit 3eeb7ec

Please sign in to comment.