Merge pull request #84 from crhowell/bugfix/ISSUE-83

Bugfix/Issue 83 UnicodeDecodeError for Windows
This commit is contained in:
jdepoix 2020-10-09 09:46:00 +02:00 committed by GitHub
commit 8d1244f430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -21,8 +21,11 @@ from youtube_transcript_api import (
def load_asset(filename): def load_asset(filename):
with open('{dirname}/assets/{filename}'.format(dirname=os.path.dirname(__file__), filename=filename)) as file: filepath = '{dirname}/assets/{filename}'.format(
return file.read() dirname=os.path.dirname(__file__), filename=filename)
with open(filepath, mode="rb") as file:
return file.read().decode('utf-8')
class TestYouTubeTranscriptApi(TestCase): class TestYouTubeTranscriptApi(TestCase):