diff --git a/twitter_cli/client.py b/twitter_cli/client.py index d1639ed..7512f3c 100644 --- a/twitter_cli/client.py +++ b/twitter_cli/client.py @@ -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, diff --git a/twitter_cli/graphql.py b/twitter_cli/graphql.py index 50f7fcd..a019460 100644 --- a/twitter_cli/graphql.py +++ b/twitter_cli/graphql.py @@ -29,7 +29,7 @@ FALLBACK_QUERY_IDS = { "UserByScreenName": "qRednkZG-rn1P6b48NINmQ", "UserTweets": "E3opETHurmVJflFsUBVuUQ", "TweetDetail": "nBS-WpgA6ZG0CyNHD517JQ", - "Likes": "aeJWz7GtGNHHO2Z3GrjCWg", + "Likes": "dv5-II7_Bup_PHish7p6fw", "SearchTimeline": "MJpyQGqgklrVl_0X9gNy3A", "Bookmarks": "uzboyXSHSJrR-mGJqep0TQ", "ListLatestTweetsTimeline": "ZBbXrl0FVnTqp7K6EAADog",