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

Set Accept-Language header to English #10

Closed
Theta-Dev opened this issue May 11, 2022 · 3 comments
Closed

Set Accept-Language header to English #10

Theta-Dev opened this issue May 11, 2022 · 3 comments

Comments

@Theta-Dev
Copy link

Theta-Dev commented May 11, 2022

Some of the data returned by the internal YouTube API is localized, e.g. the upload date string. If no Accept-Language header is present, YouTube will assume the language via the users's IP.

This leads to inconsistent output data and possible parsing errors if scrapetube is used in a non-English-speaking country.

That's why I would suggest setting the Accept-Language header to en. I am from Germany and can confirm that YouTube ouputs English date strings with that setting.

session = requests.Session()
session.headers[
    "User-Agent"
] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101
Safari/537.36"
session.headers["Accept-Language"] = "en"
@VladislavSmolyanoy
Copy link

Weird. When I edit the scrapetube.py file, nothing changes. What are the steps that you took in order to change the file?

@themegaxandy
Copy link

I am having exactly the same problem. And there should be a way to insert the location directly into the "get_channel" and "get_search" commands. That would make it much easier.

dermasmid added a commit that referenced this issue Jul 13, 2023
@dermasmid
Copy link
Owner

fixed

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

4 participants