UNPKG

nitter-scraper

Version:

A Twitter scraper that uses Nitter to fetch tweets without authentication

31 lines (30 loc) 1.18 kB
#!/usr/bin/env node "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const scraper_1 = require("./scraper"); async function main() { try { const username = "NoirLang"; // Twitter username to scrape (without @) console.log(`Starting Twitter scraper for @${username}`); // Fetch tweets const lastWeek = new Date(); lastWeek.setDate(lastWeek.getDate() - 7); const promises = await Promise.all([ (0, scraper_1.fetchTweets)(username, lastWeek, 10, true), (0, scraper_1.fetchTweets)(username, lastWeek, 10, true), (0, scraper_1.fetchTweets)(username, lastWeek, 10, true), (0, scraper_1.fetchTweets)(username, lastWeek, 10, true), (0, scraper_1.fetchTweets)(username, lastWeek, 10, true), ]); for (const [i, tweets] of promises.entries()) { console.log(`Call ${i + 1}: ${tweets.length} tweets`); } // Save tweets to file // saveTweets(tweets); } catch (error) { console.error(`Error in main function: ${error}`); } } // Run the main function main().catch(console.error);