b5i / YouTubeKit

A way to interact with YouTube's API in Swift (without any API key!)
https://swiftpackageindex.com/b5i/YouTubeKit
MIT License
83 stars 8 forks source link

HomeScreenResponse always empty answer #26

Closed 666bsw closed 2 months ago

666bsw commented 2 months ago

HomeScreenResponse always empty answer what is needed in this request to get a list of videos?

b5i commented 2 months ago

HomeScreenResponse always empty answer

Hello! You can take a look at my explanation in this issue.

what is needed in this request to get a list of videos?

You need to provide some cookies from a google account. Alternatively, you can opt to use the TrendingVideosResponse to get some videos.

666bsw commented 2 months ago

Hi! got it, thanks for the quick reply!!

666bsw commented 2 months ago

can you give an example of constructing a TrendingVideosResponse query ? for example for music? it's not very clear from the description, I'm just getting to know the library.

b5i commented 2 months ago

can you give an example of constructing a TrendingVideosResponse query ?

for example for music?

Hello! You can use the same code as the tests use (here).

As YouTube doesn't use fixed endpoints for their trending categories, YouTubeKit won't give you the constants (requestParams) as they could change anytime. However, you can try to do the request once and save the token for the music tab and reuse it in the future if you're willing to take the risk of getting an empty value if they change the parameter.