Add custom parameters to URL requests or session cookies
pupkinvaska opened this issue · 3 comments
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
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!
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 .
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.