twitter-trends-scraper
Version:
A nodejs package to scrape trending keywords from twitter automatically.
54 lines (42 loc) • 1.29 kB
Markdown
Twitter-Trends-Scraper is a nodejs package to scrape trending keywords on twitter using browser automation..
It currently runs only on windows.
```sh
npm install twitter-trends-scraper
```
In this example we first import package, then we login with cookies and scrape trending keywords.
```sh
var twitter=require("twitter-trends-scraper");
function get_data(response){
var data=response["body"]
console.log("data",data)
}
function get_trending(){
twitter.trending(get_data)
}
twitter.open("https://twitter.com/explore/tabs/trending",get_trending)
```
[](https://www.npmjs.com/package/datakund) is needed for browser automation. As soon as this package is imported in code, automated browser will open up.
```sh
var twitter=require("twitter-trends-scraper");
```
```sh
twitter.login(username,password)
```
```sh
twitter.login_cookie(list_of_cookies)
```
```sh
twitter.trending()
```
To login with cookies [Edit this Cookie Extension](https://chrome.google.com/webstore/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg?hl=en) can be added to browser
* [Telegram](https://t.me/datakund)
* [Website](https://datakund.com)