tweet-scraper

A nodejs package to scrape tweet data from twitter automatically.

Usage no npm install needed!

<script type="module">
  import tweetScraper from 'https://cdn.skypack.dev/tweet-scraper';
</script>

README

Tweet-Scraper is a nodejs package to scrape tweets, retweets of a profile using browser automation. It currently runs only on windows.

Installation

npm install tweet-scraper

Example 1

In this example we first import package, then we login with cookies and get tweets.

var twitter=require("tweet-scraper");

function get_data(response){
    var tweetdata=response["body"]
    console.log("tweetdata",tweetdata)
    #tweetdata=[{"Tweet": "Tweet"},{},]
}
function fetch_tweets(){
    twitter.get_tweets(get_data)
}
function open_profile(){
    twitter.open("https://twitter.com/narendramodi",fetch_tweets)
}
twitter.login_cookie(cookie_list,open_profile)

Example 2

In this example we first import package, then we login with cookies and get retweets.

var twitter=require("tweet-scraper");

function get_data(response){
    var retweet_data=response["body"]
    console.log("retweet_data",retweet_data)
    //#retweet_data=[{"Link": "Link", "Info": "Info"},{},...]
}
function fetch_retweets(){
        twitter.get_retweets(get_data)
}
function open_profile(){
    twitter.open("https://twitter.com/narendramodi/status/1344201660784992263/retweets",fetch_retweets)
}
twitter.login_cookie(cookie_list,open_profile)

DataKund

datakund is needed for browser automation. As soon as this package is imported in code, automated browser will open up.

Import

var twitter=require("tweet-scraper");

Login with credentials

twitter.login(username,password)

Login with cookies

twitter.login_cookie(list_of_cookies)

Get tweets

twitter.get_tweets()

Get retweets

twitter.get_retweets()

Get tweet links

twitter.get_tweet_links()

Scroll

twitter.scroll()

Cookies

To login with cookies Edit this Cookie Extension can be added to browser

Contact Us