twitter-api-scraper
v0.0.5
Published
Scrape the twitter api, no keys required.
Downloads
5
Readme
twitter-api-scraper
Get typed data from the public twitter api. No keys required.
- [x] Search tweets
- [x] Get users by username
- [x] Get users by id
- [x] Get hashflags
- [ ] Get tweets from user
- [ ] Get replies from tweet
- [ ] Get trending topics
Install
npm install --save twitter-api-scraper
Usage
Start client
First, connect() the client.
import TwitterClient from 'twitter-api-scraper'
const client = new TwitterClient()
await client.connect()
Search
const maxTweets = 3000
const result = await client.search(
{
terms: 'hello world!'
},
maxTweets
)
const { tweets, users, nextToken } = result
Typescript
import { SearchQuery, ParsedSearchResult } from 'twitter-api-scraper'
const query: SearchQuery = {
terms: '#typescript',
dateFrom: '2021-02-15',
dateTo: '2021-02-15'
}
const result: ParsedSearchResult = await client.search(query)
Search parameters
const query: SearchQuery = {
terms: '#typescript',
dateFrom: '2021-02-15',
dateTo: '2021-02-17',
minReplies: 10,
minRetweets: 10,
minFaves: 10,
lang: 'es'
}
client.search(query)
Search multiple pages
const result = await client.search(query, 100)
const { nextToken } = result
const secondPageResult = await client.search(query, 100, nextToken)
Original api response
const originalApiResult = await client.searchRaw(
{
terms: 'hello world!'
}
)
Users
Get user
const user: UserInterface = await client.getUser('jack')
Get user by id
const user: UserFromId = await client.getUserById('12')
Hashflags
const hashflags: Hashflag[] = await client.getHashflags('2021-09-23')
License
MIT © matiasngf