зеркало из
https://github.com/viginum-datalab/twscrape.git
synced 2025-10-28 20:54:24 +02:00
likes
Этот коммит содержится в:
родитель
32f83ab1cd
Коммит
08ce488c57
@ -17,6 +17,7 @@ OP_Favoriters = "E-ZTxvWWIkmOKwYdNTEefg/Favoriters"
|
||||
OP_UserTweets = "V1ze5q3ijDS1VeLwLY0m7g/UserTweets"
|
||||
OP_UserTweetsAndReplies = "16nOjYqEdV04vN6-rgg8KA/UserTweetsAndReplies"
|
||||
OP_ListLatestTweetsTimeline = "whF0_KH1fCkdLLoyNPMoEw/ListLatestTweetsTimeline"
|
||||
OP_Likes = "IohM3gxQHfvWePH5E3KuNA/Likes"
|
||||
|
||||
|
||||
GQL_URL = "https://twitter.com/i/api/graphql"
|
||||
@ -305,3 +306,22 @@ class API:
|
||||
async for rep in self.list_timeline_raw(list_id, limit=limit, kv=kv):
|
||||
for x in parse_tweets(rep, limit):
|
||||
yield x
|
||||
|
||||
# likes
|
||||
async def likes_raw(self, uid: int, limit=-1, kv=None):
|
||||
op = OP_Likes
|
||||
kv = {
|
||||
"userId": str(uid),
|
||||
"count": 40,
|
||||
"includePromotedContent": True,
|
||||
"withVoice": True,
|
||||
"withV2Timeline": True,
|
||||
**(kv or {}),
|
||||
}
|
||||
async for x in self._gql_items(op, kv, limit=limit):
|
||||
yield x
|
||||
|
||||
async def likes(self, uid: int, limit=-1, kv=None):
|
||||
async for rep in self.likes_raw(uid, limit=limit, kv=kv):
|
||||
for x in parse_tweets(rep.json(), limit):
|
||||
yield x
|
||||
@ -192,6 +192,7 @@ def run():
|
||||
c_lim("user_tweets", "Get user tweets", "user_id", "User ID", int)
|
||||
c_lim("user_tweets_and_replies", "Get user tweets and replies", "user_id", "User ID", int)
|
||||
c_lim("list_timeline", "Get tweets from list", "list_id", "List ID", int)
|
||||
c_lim("likes", "Get user's liked tweets", "user_id", "User ID", int)
|
||||
|
||||
args = p.parse_args()
|
||||
if args.command is None:
|
||||
|
||||
Загрузка…
x
Ссылка в новой задаче
Block a user