twitter-webscraper
v1.0.2
Published
A Twitter web scraper built with TypeScript and Puppeteer ## Installation To use this package in your project, run: ```bash npm i twitter-webscraper ``` ## Features - Log in to your Twitter account - Scrape tweets - Scrape user's information -
Downloads
3
Maintainers
Readme
twitter-webscraper
A Twitter web scraper built with TypeScript and Puppeteer
Installation
To use this package in your project, run:
npm i twitter-webscraper
Features
- Log in to your Twitter account
- Scrape tweets
- Scrape user's information
- Scrape user's followers
- Scrape user's following
To Implement
- Search and Scrape top and latest tweets
- Scrape logged in user's timeline
- Scrape user's tweets
Usage
const { Scraper } = require('twitter-webscraper');
const scraper = new Scraper();
(async () => {
// It will initialize the headless browser
await scraper.initializeBrowser();
// It's not necessary to log in, but if you want to have access to
// all of the features, then you need to log in.
await scraper.login('username or email', 'password');
const userInfo = await scraper.getUserInfo('username');
console.log(userInfo);
// It will close the headless browser.
// You have to write this at the end of your code.
scraper.browser.close();
})();
Methods
Method | Description
--- | ---
initializeBrowser()
| It will initialize the headless browserlogin(username_or_email: string, password: string)
| Log in to your Twitter accountgetUserInfo(username: string)
| Scrape information of the given user
getFollwers(username: string)
| Scrape followers of the given user
getFollwing(username: string)
| Scrape following of the given user
getTweet(link: string)
| Scrape the given tweet
browser.close()
| It will close the headless browser
Contributing
If you encounter a bug or you want to add new features, feel free to submit issues and enhancement requests.
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- Submit a Pull request