test: track parser fixture files

This commit is contained in:
jackwener
2026-03-10 12:08:47 +08:00
parent 19ab11d6a4
commit 4f144d1591
6 changed files with 562 additions and 0 deletions

1
.gitignore vendored
View File

@@ -6,4 +6,5 @@ build/
.venv/ .venv/
.env .env
*.json *.json
!tests/fixtures/*.json
!config.yaml !config.yaml

53
tests/fixtures/followers_page.json vendored Normal file
View File

@@ -0,0 +1,53 @@
{
"data": {
"user": {
"result": {
"timeline": {
"timeline": {
"instructions": [
{
"type": "TimelineAddEntries",
"entries": [
{
"entryId": "user-1",
"content": {
"entryType": "TimelineTimelineItem",
"itemContent": {
"user_results": {
"result": {
"rest_id": "f1",
"is_blue_verified": true,
"legacy": {
"name": "Follower One",
"screen_name": "follower1",
"description": "first follower",
"location": "Earth",
"followers_count": 123,
"friends_count": 45,
"statuses_count": 67,
"favourites_count": 89,
"profile_image_url_https": "https://img/f1.jpg",
"created_at": "Sat Mar 08 10:00:00 +0000 2026"
}
}
}
}
}
},
{
"entryId": "cursor-bottom",
"content": {
"entryType": "TimelineTimelineCursor",
"cursorType": "Bottom",
"value": "followers-cursor"
}
}
]
}
]
}
}
}
}
}
}

208
tests/fixtures/home_timeline.json vendored Normal file
View File

@@ -0,0 +1,208 @@
{
"data": {
"home": {
"home_timeline_urt": {
"instructions": [
{
"type": "TimelineAddEntries",
"entries": [
{
"entryId": "tweet-1",
"content": {
"entryType": "TimelineTimelineItem",
"itemContent": {
"tweet_results": {
"result": {
"__typename": "Tweet",
"rest_id": "1",
"core": {
"user_results": {
"result": {
"rest_id": "u1",
"core": {
"name": "Alice",
"screen_name": "alice"
},
"legacy": {
"name": "Alice",
"screen_name": "alice",
"verified": false,
"profile_image_url_https": "https://img/alice.jpg"
}
}
}
},
"legacy": {
"full_text": "Hello\nworld",
"created_at": "Sat Mar 08 12:00:00 +0000 2026",
"favorite_count": 10,
"retweet_count": 2,
"reply_count": 1,
"quote_count": 0,
"bookmark_count": 3,
"lang": "en",
"entities": {
"urls": [
{
"expanded_url": "https://example.com/post"
}
]
},
"extended_entities": {
"media": [
{
"type": "photo",
"media_url_https": "https://pbs.twimg.com/1.jpg",
"original_info": {
"width": 1200,
"height": 800
}
}
]
}
},
"views": {
"count": "1234"
}
}
}
}
}
},
{
"entryId": "tweet-2",
"content": {
"entryType": "TimelineTimelineItem",
"itemContent": {
"tweet_results": {
"result": {
"__typename": "Tweet",
"rest_id": "2",
"core": {
"user_results": {
"result": {
"rest_id": "u2",
"core": {
"name": "Bob",
"screen_name": "bob"
},
"legacy": {
"name": "Bob",
"screen_name": "bob",
"verified": true,
"profile_image_url_https": "https://img/bob.jpg"
}
}
}
},
"legacy": {
"full_text": "RT wrapper",
"created_at": "Sat Mar 08 12:01:00 +0000 2026",
"favorite_count": 5,
"retweet_count": 1,
"reply_count": 0,
"quote_count": 0,
"bookmark_count": 0,
"lang": "zh",
"entities": {
"urls": []
},
"retweeted_status_result": {
"result": {
"__typename": "Tweet",
"rest_id": "20",
"core": {
"user_results": {
"result": {
"rest_id": "u20",
"core": {
"name": "Carol",
"screen_name": "carol"
},
"legacy": {
"name": "Carol",
"screen_name": "carol",
"verified": false,
"profile_image_url_https": "https://img/carol.jpg"
}
}
}
},
"quoted_status_result": {
"result": {
"__typename": "Tweet",
"rest_id": "30",
"core": {
"user_results": {
"result": {
"rest_id": "u30",
"core": {
"name": "Dan",
"screen_name": "dan"
},
"legacy": {
"name": "Dan",
"screen_name": "dan",
"verified": false,
"profile_image_url_https": "https://img/dan.jpg"
}
}
}
},
"legacy": {
"full_text": "quoted text",
"created_at": "Sat Mar 08 11:58:00 +0000 2026",
"favorite_count": 1,
"retweet_count": 0,
"reply_count": 0,
"quote_count": 0,
"bookmark_count": 0,
"lang": "en",
"entities": {
"urls": []
}
}
}
},
"legacy": {
"full_text": "original retweeted post",
"created_at": "Sat Mar 08 11:59:00 +0000 2026",
"favorite_count": 50,
"retweet_count": 7,
"reply_count": 2,
"quote_count": 1,
"bookmark_count": 4,
"lang": "en",
"entities": {
"urls": []
}
},
"views": {
"count": "999"
}
}
}
},
"views": {
"count": "10"
}
}
}
}
}
},
{
"entryId": "cursor-bottom",
"content": {
"entryType": "TimelineTimelineCursor",
"cursorType": "Bottom",
"value": "cursor-bottom-1"
}
}
]
}
]
}
}
}
}

75
tests/fixtures/list_timeline.json vendored Normal file
View File

@@ -0,0 +1,75 @@
{
"data": {
"list": {
"tweets_timeline": {
"timeline": {
"instructions": [
{
"type": "TimelineAddEntries",
"entries": [
{
"entryId": "list-tweet-1",
"content": {
"entryType": "TimelineTimelineItem",
"itemContent": {
"tweet_results": {
"result": {
"__typename": "TweetWithVisibilityResults",
"tweet": {
"__typename": "Tweet",
"rest_id": "700",
"core": {
"user_results": {
"result": {
"rest_id": "u700",
"core": {
"name": "Lister",
"screen_name": "lister"
},
"legacy": {
"name": "Lister",
"screen_name": "lister",
"verified": true,
"profile_image_url_https": "https://img/lister.jpg"
}
}
}
},
"legacy": {
"full_text": "list timeline tweet",
"created_at": "Sat Mar 08 13:10:00 +0000 2026",
"favorite_count": 8,
"retweet_count": 2,
"reply_count": 1,
"quote_count": 0,
"bookmark_count": 1,
"lang": "zh",
"entities": {
"urls": []
}
},
"views": {
"count": "321"
}
}
}
}
}
}
},
{
"entryId": "cursor-bottom",
"content": {
"entryType": "TimelineTimelineCursor",
"cursorType": "Bottom",
"value": "list-cursor"
}
}
]
}
]
}
}
}
}
}

107
tests/fixtures/search_timeline.json vendored Normal file
View File

@@ -0,0 +1,107 @@
{
"data": {
"search_by_raw_query": {
"search_timeline": {
"timeline": {
"instructions": [
{
"type": "TimelineAddEntries",
"entries": [
{
"entryId": "search-module-1",
"content": {
"entryType": "TimelineTimelineModule",
"items": [
{
"item": {
"itemContent": {
"tweet_results": {
"result": {
"__typename": "TweetWithVisibilityResults",
"tweet": {
"__typename": "Tweet",
"rest_id": "500",
"core": {
"user_results": {
"result": {
"rest_id": "u500",
"core": {
"name": "Searcher",
"screen_name": "searcher"
},
"legacy": {
"name": "Searcher",
"screen_name": "searcher",
"verified": false,
"profile_image_url_https": "https://img/searcher.jpg"
}
}
}
},
"legacy": {
"full_text": "search result with video",
"created_at": "Sat Mar 08 13:00:00 +0000 2026",
"favorite_count": 12,
"retweet_count": 4,
"reply_count": 1,
"quote_count": 0,
"bookmark_count": 2,
"lang": "en",
"entities": {
"urls": []
},
"extended_entities": {
"media": [
{
"type": "video",
"media_url_https": "https://pbs.twimg.com/thumb.jpg",
"original_info": {
"width": 1280,
"height": 720
},
"video_info": {
"variants": [
{
"content_type": "video/mp4",
"bitrate": 832000,
"url": "https://video-low.mp4"
},
{
"content_type": "video/mp4",
"bitrate": 2176000,
"url": "https://video-high.mp4"
}
]
}
}
]
}
},
"views": {
"count": "4321"
}
}
}
}
}
}
}
]
}
},
{
"entryId": "cursor-bottom",
"content": {
"entryType": "TimelineTimelineCursor",
"cursorType": "Bottom",
"value": "search-cursor"
}
}
]
}
]
}
}
}
}
}

118
tests/fixtures/tweet_detail.json vendored Normal file
View File

@@ -0,0 +1,118 @@
{
"data": {
"threaded_conversation_with_injections_v2": {
"instructions": [
{
"type": "TimelineAddEntries",
"entries": [
{
"entryId": "conversation-thread",
"content": {
"items": [
{
"item": {
"itemContent": {
"tweet_results": {
"result": {
"__typename": "Tweet",
"rest_id": "100",
"core": {
"user_results": {
"result": {
"rest_id": "ua",
"core": {
"name": "Author A",
"screen_name": "authora"
},
"legacy": {
"name": "Author A",
"screen_name": "authora",
"verified": false,
"profile_image_url_https": "https://img/a.jpg"
}
}
}
},
"legacy": {
"full_text": "root tweet",
"created_at": "Sat Mar 08 12:10:00 +0000 2026",
"favorite_count": 100,
"retweet_count": 10,
"reply_count": 2,
"quote_count": 1,
"bookmark_count": 8,
"lang": "en",
"entities": {
"urls": []
}
},
"views": {
"count": "8000"
}
}
}
}
}
},
{
"item": {
"itemContent": {
"tweet_results": {
"result": {
"__typename": "Tweet",
"rest_id": "101",
"core": {
"user_results": {
"result": {
"rest_id": "ub",
"core": {
"name": "Author B",
"screen_name": "authorb"
},
"legacy": {
"name": "Author B",
"screen_name": "authorb",
"verified": false,
"profile_image_url_https": "https://img/b.jpg"
}
}
}
},
"legacy": {
"full_text": "reply tweet",
"created_at": "Sat Mar 08 12:12:00 +0000 2026",
"favorite_count": 5,
"retweet_count": 1,
"reply_count": 0,
"quote_count": 0,
"bookmark_count": 0,
"lang": "en",
"entities": {
"urls": []
}
},
"views": {
"count": "100"
}
}
}
}
}
}
]
}
},
{
"entryId": "cursor-bottom",
"content": {
"entryType": "TimelineTimelineCursor",
"cursorType": "Bottom",
"value": "conversation-cursor"
}
}
]
}
]
}
}
}