import { Scraper } from "@the-convocation/twitter-scraper";
const scraper = new Scraper();
const cookieString = process.env.COOKIE_STRING;
if (cookieString) {
// Parse the cookie string into trimmed name=value pairs
const cookies = cookieString
.split(/;\s*/)
.map((c) => c.trim())
.filter(Boolean);
// The library accepts an array of cookie strings or tough-cookie Cookie objects
await scraper.setCookies(cookies);
}
const latestTweets = await scraper.getTweets("toly", 10);
console.log(latestTweets);
Expected
10 latest tweets of "toly"
Result
Nothing

Expected
10 latest tweets of "toly"
Result
Nothing