1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { searchTweets } from "https://esm.town/v/andreterron/searchTweets";
export async function searchPostsForTheActuallyBot(accessToken: string): Promise<{
id: string;
text: string;
author_id: string;
}[]> {
// Search
const results = await searchTweets({
accessToken,
query:
'"twitter" (elon OR musk) -"X" -"𝕏" -follow -twerk -selfie -nft -crypto -is:retweet -is:reply -is:quote lang:en -has:links',
params: {
"tweet.fields": "created_at,public_metrics,author_id",
},
});
//
// Filter
return (results ?? [])
.filter((post) => {
const words = post.text.split(/\s+/);
return !(words.includes("x") || words.includes("X") ||
words.includes("𝕏"));
});
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023