Back

Version 12

8/17/2023
async function searchPostsForTheActuallyBot(accessToken: string): Promise<{
id: string;
text: string;
}[]> {
// Search
const q = new URLSearchParams({
query:
'"twitter" -"X" -follow -twerk -selfie -nft -crypto -is:retweet -is:quote lang:en -has:links',
"tweet.fields": "created_at,public_metrics,author_id",
// "user.fields": "public_metrics",
"expansions": "author_id",
});
const results = await @stevekrouse.fetchJSON(
`https://api.twitter.com/2/tweets/search/recent?${q.toString()}`,
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
},
);
console.log(results);
//
// Filter
return results.data
.filter((post) => {
const words = post.text.split(/\s+/);
return !(words.includes("x") || words.includes("X") ||
words.includes("𝕏"));
});
}
Updated: October 23, 2023