Tweet Harvest is an active command-line interface (CLI) tool designed for scraping tweets from Twitter search results. Utilizing Playwright, it automates browser interactions to retrieve data based on specified keywords and date ranges, exporting the results to CSV or XLSX formats. The current stable version is 2.7.1, with frequent minor releases addressing bug fixes, performance improvements, and new export functionalities (e.g., XLSX export in v2.7.0). A key differentiator is its reliance on a valid Twitter `auth_token` cookie for authentication, as Twitter prohibits unauthenticated search. While primarily a CLI, it also exposes programmatic APIs for integration into Node.js applications, offering functions to initiate the scraping process and process tweet data. Its continuous updates ensure compatibility with Twitter's evolving interface and provide enhanced data quality features like ISO 8601 timestamps.
npm install tweet-harvestVerified import paths — ran on the pinned version, not inferred.
Demonstrates programmatic usage of `tweet-harvest` to scrape tweets with specified keywords and date ranges, requiring a Twitter authentication token.
Use the full `--to` flag instead of the `-t` short option, or consult CLI help for current short options.
Regularly obtain an updated `auth_token` by logging into Twitter in your browser and extracting the `auth_token` cookie. Pass it via the `--auth-token` CLI option or `auth_token` option in programmatic usage.
Update CSV parsing logic to expect comma-separated values, or check for an option to explicitly set the delimiter if one is introduced in later versions.
Ensure you are using the latest version of `tweet-harvest` to benefit from upstream fixes for Twitter's evolving platform. If issues persist, your `auth_token` might be outdated or Twitter may have implemented new anti-scraping measures.
Review CSV output and update any downstream processing scripts to be resilient to changes in header order or to specifically match headers by name rather than by index.
Run `npx playwright install` in your project directory to download the necessary browser binaries for Playwright.
Log into Twitter in a browser, extract a fresh `auth_token` cookie, and update your configuration or environment variable. Ensure there are no leading/trailing spaces or other characters.
Check your internet connection, ensure no other processes are interfering with Playwright, and try running in a headful mode (if available via options) to debug browser launch issues. Ensure your Node.js version is compatible with Playwright.
Check the `tweet-harvest` changelog for recent versions to identify changes in export format. Adjust your CSV parsing logic to account for new delimiters, header order, or additional columns.