-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Crash due to unicode decode error while getting video title from vtt #138
Comments
gpt & stack overflow recommend setting a default encoding of with open(info_file, 'r', encoding='utf-8', errors='ignore') as f:
return json.load(f)['title'] Would you mind providing a channel url to reproduce this on? |
I have downloaded via pip today, and had the same issue. Made your suggested change:
and after that it worked. |
…e_error Hotfix for unicode decode error #138
Fixed in v0.1.44. Bug was introduced on 896f8fd by writing json to file system which will be encoded differently on Windows. Should be solved/prevented by specifying the |
Might be a malformed character in a video title. Would it be possible to let yt-fts skip undefined characters and throw a warning instead of a crash?
Adding subtitles to database... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0% -:--:--
Traceback (most recent call last):
File "c:\users\derja\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\derja\appdata\local\programs\python\python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\derja\AppData\Local\Programs\Python\Python39\Scripts\yt-fts.exe_main.py", line 7, in
File "c:\users\derja\appdata\local\programs\python\python39\lib\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
File "c:\users\derja\appdata\local\programs\python\python39\lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
File "c:\users\derja\appdata\local\programs\python\python39\lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\derja\appdata\local\programs\python\python39\lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\derja\appdata\local\programs\python\python39\lib\site-packages\click\core.py", line 783, in invoke
return _callback(*args, **kwargs)
File "c:\users\derja\appdata\local\programs\python\python39\lib\site-packages\yt_fts\yt_fts.py", line 63, in download
foo = download_channel(channel_id, channel_name, language, number_of_jobs, s)
File "c:\users\derja\appdata\local\programs\python\python39\lib\site-packages\yt_fts\download.py", line 264, in download_channel
vtt_to_db(channel_id, tmp_dir, s)
File "c:\users\derja\appdata\local\programs\python\python39\lib\site-packages\yt_fts\download.py", line 174, in vtt_to_db
vid_title = get_vid_title(os.path.join(os.path.dirname(vtt), f'{vid_id}.info.json'))
File "c:\users\derja\appdata\local\programs\python\python39\lib\site-packages\yt_fts\download.py", line 196, in get_vid_title
return json.load(f)['title']
File "c:\users\derja\appdata\local\programs\python\python39\lib\json_init.py", line 293, in load
return loads(fp.read(),
File "c:\users\derja\appdata\local\programs\python\python39\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 273833: character maps to
The text was updated successfully, but these errors were encountered: