Add recognition of other types of cursors on Tweet Detail page
This commit is contained in:
parent
64bb8233f0
commit
459fbb4f2f
@ -541,7 +541,12 @@ func (api_response APIV2Response) GetCursorBottom() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For a Tweet Detail page:
|
// For a Tweet Detail page:
|
||||||
if entry.Content.ItemContent.CursorType == "Bottom" {
|
if entry.Content.ItemContent.CursorType == "Bottom" ||
|
||||||
|
entry.Content.ItemContent.CursorType == "ShowMoreThreadsPrompt" ||
|
||||||
|
entry.Content.ItemContent.CursorType == "ShowMoreThreads" {
|
||||||
|
// "Bottom": normal cursor, auto-loads when it scrolls into view
|
||||||
|
// "ShowMoreThreads": normal cursor, but you have to click it to load more
|
||||||
|
// "ShowMoreThreadsPrompt": show offensive/low quality replies
|
||||||
return entry.Content.ItemContent.Value
|
return entry.Content.ItemContent.Value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -785,3 +785,16 @@ func TestTweetWithInlineLabel(t *testing.T) {
|
|||||||
assert.Len(trove.Tweets, 1)
|
assert.Len(trove.Tweets, 1)
|
||||||
assert.Len(trove.Users, 1)
|
assert.Len(trove.Users, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestTweetDetailWithShowMoreButton(t *testing.T) {
|
||||||
|
assert := assert.New(t)
|
||||||
|
data, err := os.ReadFile("test_responses/api_v2/tweet_detail_with_show_more_replies_button.json")
|
||||||
|
require.NoError(t, err)
|
||||||
|
var resp APIV2Response
|
||||||
|
|
||||||
|
err = json.Unmarshal(data, &resp)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
// Test the "Show more replies" cursor
|
||||||
|
assert.Equal("NwAAAPANHBlWhMC--YvZ3a8ugsDS1aGWqbAugIDQ6dCa3xIAYL314NGqsAkA0OGFzYqwLiUEERUOAAA", resp.GetCursorBottom())
|
||||||
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user