invidious
invidious copied to clipboard
Hashtag API: Parse header when getting the first page
When requesting the first page of a hashtag (without continuations), YouTube will include a hashtag header that includes info such as the # of videos and # of channels in the hashtag.
This PR will parse those properties (it also creates separate structs for the hashtag page + header)
Before
{
"results": [
{
"type": "video",
...
}
]
}
After
Page 1:
{
"type": "hashtagPage",
"header": {
"type": "hashtag",
"title": "#cat",
"url": "/hashtag/cat",
"channelCount": 8100000,
"videoCount": 1100000
},
"results": [
{
"type": "video",
...
}
],
"hasNextPage": true
}
Page 2:
{
"type": "hashtagPage",
"results": [
{
"type": "video",
...
}
],
"hasNextPage": true
}
Tests:
go to : /api/v1/hashtag/cat?page=1 or /api/v1/hashtag/cat and see the header in the json response
go to /api/v1/hashtag/cat?page=2 and no longer see the header on page 2
Are these infos really useful? The numbers looks very approximated.
Are these infos really useful? The numbers looks very approximated.
It was mentioned in my PR to add hashtag pags to FreeTube https://github.com/FreeTubeApp/FreeTube/pull/3483#issuecomment-1537138092
@efb4f5ff-1298-471a-8973-3d47447115dc any thoughts on this?
Sorry for the delay. So i mentioned the possibility to add this because with the stats the user knows what they are getting into. A hashtag with low amount of approximate videos could make the user go through all of them and a high amount can make the user refrain from watching too much and falling into hours of watching videos.
Ah, I see, thanks!
This pull request has been automatically marked as stale and will be closed in 30 days because it has not had recent activity and is much likely abandoned or outdated. If you think this pull request is still relevant and applicable, you just have to post a comment and it will be unmarked.
Updated and working again
This pull request has been automatically marked as stale and will be closed in 30 days because it has not had recent activity and is much likely abandoned or outdated. If you think this pull request is still relevant and applicable, you just have to post a comment and it will be unmarked.
Code is still working, I also added some tests to the description