fix: update Likes queryId and response path (fixes #8)
- Update Likes fallback queryId: aeJWz7GtGNHHO2Z3GrjCWg -> dv5-II7_Bup_PHish7p6fw - Fix response path: data.user.result.timeline.timeline.instructions (Twitter renamed timeline_v2 to timeline; code now tries both) - Verified via Playwright: API returns 200 with correct tweet entries Fixes #8
This commit is contained in:
@@ -246,10 +246,20 @@ class TwitterClient:
|
||||
def fetch_user_likes(self, user_id, count=20):
|
||||
# type: (str, int) -> List[Tweet]
|
||||
"""Fetch tweets liked by a user."""
|
||||
|
||||
def get_likes_instructions(data):
|
||||
# type: (Any) -> Any
|
||||
# New path (2024+): data.user.result.timeline.timeline.instructions
|
||||
instructions = _deep_get(data, "data", "user", "result", "timeline", "timeline", "instructions")
|
||||
if instructions is None:
|
||||
# Legacy path: data.user.result.timeline_v2.timeline.instructions
|
||||
instructions = _deep_get(data, "data", "user", "result", "timeline_v2", "timeline", "instructions")
|
||||
return instructions
|
||||
|
||||
return self._fetch_timeline(
|
||||
"Likes",
|
||||
count,
|
||||
lambda data: _deep_get(data, "data", "user", "result", "timeline_v2", "timeline", "instructions"),
|
||||
get_likes_instructions,
|
||||
extra_variables={
|
||||
"userId": user_id,
|
||||
"includePromotedContent": False,
|
||||
|
||||
Reference in New Issue
Block a user