youtube-explore
youtube-explore copied to clipboard
Script can't handle non-ASCII characters in video titles
I usually use Python 3+, which handles unicode natively. I created a 2.7 virtualenv, and it's failing when video titles have accented characters.
The error happens on line 234, when video title is printed:
File "follow-youtube-recommendations.py", line 234, in get_recommendations
print(video_id + ': ' + video['title'] + ' [' + channel + ']{' + repr(key) +'} ' + str(video['views']
File "...\envs\py27\lib\encodings\cp850.py", line 12, in
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u2019' in position 25: character maps to <u