Skip to content
This repository has been archived by the owner on Jan 31, 2021. It is now read-only.

Add custom parameters to URL requests or session cookies #20

Open
pupkinvaska opened this issue Oct 3, 2019 · 3 comments
Open

Add custom parameters to URL requests or session cookies #20

pupkinvaska opened this issue Oct 3, 2019 · 3 comments

Comments

@pupkinvaska
Copy link

Are there options to add custom parameters to URL requests or session cookies? I need to set youtube preferences such as language or country. Without them i can't scrape comments of some YT videos which are blocked in my country

@philbot9
Copy link
Owner

philbot9 commented Oct 8, 2019

Hey there,

Can you give me an example of what preferences you would like to set? What should the URL look like in that case?

Thanks!

@pupkinvaska
Copy link
Author

I can click on user pic or "3 dots" if not logged in -> Location, and choose any country. This way I can access videos that YouTube does not allow to play in my country.
The same thing I can set up via the URL parameter &gl=AU (for example, AU for Australia) appending it to any Youtube request.
Or via the cookie: PREF="gl=AU"
This cookie to set up country & switch interface language to English: PREF="gl=AU&hl=en"
Language code "hl=en" to localize "time" strings such as "3 months ago" to the desired language in the Scraper's output .

@pupkinvaska
Copy link
Author

As a temporary solution I modified the file:
youtube-comment-scraper-cli/node_modules/youtube-comments-task/dist/lib/youtube-api/url-builder.js
To the string return VIDEO_PAGE_URL + '?' + query;
I added +'&gl=AU';
Now it works.

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

No branches or pull requests

2 participants