Skip to content

Commit

Permalink
Specifies the language when getting the video url
Browse files Browse the repository at this point in the history
It allows getting error messages in the user's language.
  • Loading branch information
Taapat committed Sep 15, 2023
1 parent 34a4fd8 commit e500579
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ jobs:
sed -i 's/from Components/# from Components/g' src/YouTubeVideoUrl.py
sed -i 's/config.plugins.YouTube.maxResolution.value/"22"/g' src/YouTubeVideoUrl.py
sed -i 's/config.plugins.YouTube.useDashMP4.value/True/g' src/YouTubeVideoUrl.py
sed -i 's/config.plugins.YouTube.searchLanguage.value/"en"/g' src/YouTubeVideoUrl.py
- name: Test code with pytest
run: |
pytest -rx -v --cov=src --cov-report=xml --cov-report=html
Expand Down
4 changes: 2 additions & 2 deletions src/YouTubeVideoUrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def _extract_player_response(self, video_id, client):
data['playbackContext']['contentPlaybackContext']['signatureTimestamp'] = sts
data['context'] = {
'client': {
'hl': 'en',
'hl': config.plugins.YouTube.searchLanguage.value,
'clientName': 'TVHTML5_SIMPLY_EMBEDDED_PLAYER',
'clientVersion': '2.0',
},
Expand All @@ -258,7 +258,7 @@ def _extract_player_response(self, video_id, client):
else:
data['context'] = {
'client': {
'hl': 'en',
'hl': config.plugins.YouTube.searchLanguage.value,
'clientVersion': '17.31.35',
'androidSdkVersion': 31,
'clientName': 'ANDROID',
Expand Down

0 comments on commit e500579

Please sign in to comment.