Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zmovane/rex
Reverse Engineered Twitter's API
https://github.com/zmovane/rex
reverse-engineering scraper twitter twitter-api twitter-api-v2 twitter-scraper twitterscraper
Last synced: about 2 months ago
JSON representation
Reverse Engineered Twitter's API
- Host: GitHub
- URL: https://github.com/zmovane/rex
- Owner: zmovane
- Created: 2023-09-10T17:19:05.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-06T10:40:00.000Z (about 1 year ago)
- Last Synced: 2024-10-11T07:54:49.510Z (3 months ago)
- Topics: reverse-engineering, scraper, twitter, twitter-api, twitter-api-v2, twitter-scraper, twitterscraper
- Language: Go
- Homepage:
- Size: 185 KB
- Stars: 69
- Watchers: 2
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# reX
[![go report card](https://goreportcard.com/badge/github.com/amovane/reX "go report card")](https://goreportcard.com/report/github.com/amovane/reX)
[![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)
Since twitter dev removed the API for accessing user followers and following, developers have found it difficult to obtain this data. Here, I'm sharing my reverse engineering solution. If it's helpful to you, please let me know.
## Installation
```
go get -u github.com/amovane/reX
```## Login
```golang
uname := os.Getenv("USER_NAME")
upwd := os.Getenv("PASSWORD")
x := reX.New()
wd, _ := os.Getwd()
cookiesPath := fmt.Sprintf("%s/cookies.json", wd)
err := x.SetCookies(cookiesPath)
if err != nil || !x.IsLoggedIn() {
println("You must login first")
x.Login(uname, upwd)
x.SaveCookies(cookiesPath)
}
```## Followings
```golang
var cursor *string
var tweets []reX.UserResults
for {
tweets, cursor, err = x.GetFollowingsByScreenName("shareverse_", cursor)
for _, tweet := range tweets {
println(tweet.Result.Legacy.ScreenName)
}
if cursor == nil || err != nil {
break
}
}
```## Followers
```golang
var cursor *string
var tweets []reX.UserResults
for {
tweets, cursor, err = x.GetFollowerssByScreenName("shareverse_", cursor)
for _, tweet := range tweets {
println(tweet.Result.Legacy.ScreenName)
}
if cursor == nil || err != nil {
break
}
}
```## Is following
```golang
uid, _ := x.GetUserIDByScreenName("jarredsumner")
uidOfFollower, _ := x.GetUserIDByScreenName("cybermageek")
isFollowing := x.IsFollowing(uid, uidOfFollower)
```