Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arguments to define searching page #53

Open
JorgeOrozcoP opened this issue Dec 2, 2020 · 2 comments
Open

Arguments to define searching page #53

JorgeOrozcoP opened this issue Dec 2, 2020 · 2 comments

Comments

@JorgeOrozcoP
Copy link

I am trying to use the API, but I don't understand how to get videos from multiple search pages. The example in index.html says

http://youtube-scrape.herokuapp.com/api/search?q=herman%20fassett&page=1

which I tried but always returns results for page 1. In the README documentation you mention to use the key and pageToken arguments. What do they mean and how to use them?

Thanks in advance

@HermanFassett
Copy link
Owner

Yeah sorry the index.html needs to be updated.
I wish I could just keep using page but youtube search doesn't use literal pages anymore (it lazy loads infinitely).
To get pages you'll have to call a first query with just q parameter which will give you the first page as well as a key and a nextPageToken. Then to get page 2 you just pass the key and pageToken as parameters and that will return page 2 as well as the nextPageToken for page 3. Let me know if that doesn't make sense, I wish it could be easier.
It could potentially be made to work like it did previously but it would require youtube-scrape to do this in the background and load n - 1 pages before it can get the token for page n.

@JorgeOrozcoP
Copy link
Author

Perfect, I can continue working with this info. Thanks for the quick reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants