Skip to content

Commit

Permalink
add tweet_replies method #104
Browse files Browse the repository at this point in the history
  • Loading branch information
vladkens committed Feb 10, 2024
1 parent d579c5f commit 6114ebe
Show file tree
Hide file tree
Showing 20 changed files with 52,334 additions and 47,338 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/stale-issues.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: 'Close stale issues and PRs'
name: close stale issues

on:
workflow_dispatch:
schedule:
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ update-mocks:
twscrape followers --raw --limit 10 2244994945 | jq > ./tests/mocked-data/raw_followers.json
twscrape following --raw --limit 10 2244994945 | jq > ./tests/mocked-data/raw_following.json
twscrape tweet_details --raw 1649191520250245121 | jq > ./tests/mocked-data/raw_tweet_details.json
twscrape tweet_replies --limit 1 --raw 1649191520250245121 | jq > ./tests/mocked-data/raw_tweet_replies.json
twscrape retweeters --raw --limit 10 1649191520250245121 | jq > ./tests/mocked-data/raw_retweeters.json
twscrape favoriters --raw --limit 10 1649191520250245121 | jq > ./tests/mocked-data/raw_favoriters.json
twscrape user_tweets --raw --limit 10 2244994945 | jq > ./tests/mocked-data/raw_user_tweets.json
twscrape user_tweets_and_replies --raw --limit 10 2244994945 | jq > ./tests/mocked-data/raw_user_tweets_and_replies.json
twscrape search --raw --limit 10 "elon musk lang:en" | jq > ./tests/mocked-data/raw_search.json
twscrape list_timeline --raw --limit 10 1494877848087187461 | jq > ./tests/mocked-data/raw_list_timeline.json
twscrape likes --raw --limit 10 2244994945 | jq > ./tests/mocked-data/raw_likes.json
twscrape liked_tweets --raw --limit 10 2244994945 | jq > ./tests/mocked-data/raw_likes.json
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ async def main():
await gather(api.retweeters(tweet_id, limit=20)) # list[User]
await gather(api.favoriters(tweet_id, limit=20)) # list[User]

# Note: this method have small pagination from X side, like 5 tweets per query
await gather(api.tweet_replies(tweet_id, limit=20)) # list[Tweet]

# get user by login
user_login = "xdevelopers"
await api.user_by_login(user_login) # User
Expand Down Expand Up @@ -234,6 +237,7 @@ twscrape --db test-accounts.db <command>
```sh
twscrape search "QUERY" --limit=20
twscrape tweet_details TWEET_ID
twscrape tweet_replies TWEET_ID --limit=20
twscrape retweeters TWEET_ID --limit=20
twscrape favoriters TWEET_ID --limit=20
twscrape user_by_id USER_ID
Expand Down
36 changes: 18 additions & 18 deletions tests/mocked-data/raw_favoriters.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@
}
},
"fast_followers_count": 0,
"favourites_count": 6002,
"followers_count": 897,
"favourites_count": 6001,
"followers_count": 898,
"friends_count": 2634,
"has_custom_timelines": true,
"is_translator": false,
"listed_count": 2,
"location": "India",
"media_count": 380,
"name": "Tarun Gupta #ngIndia",
"normal_followers_count": 897,
"normal_followers_count": 898,
"pinned_tweet_ids_str": [
"1754277413373292641"
],
Expand All @@ -126,7 +126,7 @@
"profile_image_url_https": "https://pbs.twimg.com/profile_images/1736141291011158016/d5syLOws_normal.jpg",
"profile_interstitial_type": "",
"screen_name": "TarunDevops",
"statuses_count": 2322,
"statuses_count": 2320,
"translator_type": "none",
"url": "https://t.co/H5vY4SfIeh",
"verified": false,
Expand Down Expand Up @@ -421,7 +421,7 @@
"fast_followers_count": 0,
"favourites_count": 8,
"followers_count": 1,
"friends_count": 50,
"friends_count": 51,
"has_custom_timelines": false,
"is_translator": false,
"listed_count": 0,
Expand Down Expand Up @@ -479,15 +479,15 @@
},
"fast_followers_count": 0,
"favourites_count": 6392,
"followers_count": 737,
"followers_count": 736,
"friends_count": 4980,
"has_custom_timelines": true,
"is_translator": false,
"listed_count": 8,
"location": "Other Universe.",
"media_count": 74,
"name": "98𝕰𝖑𝖎𝖙𝖊𝕸𝕲𝖍𝖔𝖘𝖙~59~𝕺𝖛𝖊𝖗𝕷𝖔𝖗𝖉54",
"normal_followers_count": 737,
"normal_followers_count": 736,
"pinned_tweet_ids_str": [
"1746638470255157399"
],
Expand Down Expand Up @@ -885,23 +885,23 @@
}
},
"fast_followers_count": 0,
"favourites_count": 98727,
"followers_count": 17859,
"friends_count": 19631,
"favourites_count": 98732,
"followers_count": 17863,
"friends_count": 19636,
"has_custom_timelines": true,
"is_translator": false,
"listed_count": 2,
"location": "Aracaju Sergipe Brasil",
"media_count": 365,
"name": "Pedro Vasconcelos🎶",
"normal_followers_count": 17859,
"normal_followers_count": 17863,
"pinned_tweet_ids_str": [],
"possibly_sensitive": false,
"profile_banner_url": "https://pbs.twimg.com/profile_banners/81217433/1672402393",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/1684590879594491905/0DyAIFwY_normal.jpg",
"profile_interstitial_type": "",
"screen_name": "psvas5",
"statuses_count": 40314,
"statuses_count": 40317,
"translator_type": "none",
"url": "https://t.co/JDYYzUaorM",
"verified": false,
Expand Down Expand Up @@ -1017,15 +1017,15 @@
},
"fast_followers_count": 0,
"favourites_count": 270,
"followers_count": 130,
"friends_count": 573,
"followers_count": 131,
"friends_count": 572,
"has_custom_timelines": false,
"is_translator": false,
"listed_count": 0,
"location": "New Jersey.USA",
"media_count": 1,
"name": "Elena",
"normal_followers_count": 130,
"normal_followers_count": 131,
"pinned_tweet_ids_str": [],
"possibly_sensitive": false,
"profile_banner_url": "https://pbs.twimg.com/profile_banners/2534108054/1704819706",
Expand Down Expand Up @@ -1076,15 +1076,15 @@
},
"fast_followers_count": 0,
"favourites_count": 476,
"followers_count": 90,
"followers_count": 89,
"friends_count": 341,
"has_custom_timelines": false,
"is_translator": false,
"listed_count": 0,
"location": "๊USA",
"media_count": 1,
"name": "rajibelena",
"normal_followers_count": 90,
"normal_followers_count": 89,
"pinned_tweet_ids_str": [],
"possibly_sensitive": false,
"profile_banner_url": "https://pbs.twimg.com/profile_banners/2843756880/1705349988",
Expand Down Expand Up @@ -1207,7 +1207,7 @@
}
},
"fast_followers_count": 0,
"favourites_count": 1198,
"favourites_count": 1197,
"followers_count": 19,
"friends_count": 116,
"has_custom_timelines": false,
Expand Down
Loading

0 comments on commit 6114ebe

Please sign in to comment.