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

Encoding error when watching some Crunchyroll videos as authenticated user #387

Closed
dilworks opened this Issue May 11, 2014 · 6 comments

Comments

Projects
None yet
3 participants
@dilworks

dilworks commented May 11, 2014

When trying to watch certain Crunchyroll videos using a premium account, they always fail with the following error:

livestreamer -l debug --crunchyroll-username=USERNAME http://www.crunchyroll.com/soredemo-machi-wa-mawatteiru-manga-25/soredemo-machi-wa-mawatteiru-manga-25-pv-649865 mid
Enter Crunchyroll password: 
[cli][info] Found matching plugin crunchyroll for URL http://www.crunchyroll.com/soredemo-machi-wa-mawatteiru-manga-25/soredemo-machi-wa-mawatteiru-manga-25-pv-649865
[plugin.crunchyroll][debug] Creating session...
[plugin.crunchyroll][debug] Success!
[plugin.crunchyroll][info] Trying to login using user and password...
[plugin.crunchyroll][info] Success!
error: 'ascii' codec can't encode character u'\xf3' in position 25: ordinal not in range(128)

However, the same videos do play if they're played as a regular non-registered user (after purging the credentials, and if the video is unrestricted). Of course since you're playing unauthenticated, you're restricted to the lowest possible quality, which obviously sucks.

Not all videos exhibit this problem, but so far I've noticed it impacts shows like this the following:
http://www.crunchyroll.com/soredemo-machi-wa-mawatteiru-manga-25
http://www.crunchyroll.com/hadigirl-manga-25

I'm using Debian Jessie (Testing), AMD64, with Python 2.7.6

@asermax

This comment has been minimized.

Show comment
Hide comment
@asermax

asermax May 11, 2014

Contributor

I'm not getting that error for the url you posted.
Nevethless, given the kind of error, I'm betting it's because of the string on this line not having the unicode prefix.

Contributor

asermax commented May 11, 2014

I'm not getting that error for the url you posted.
Nevethless, given the kind of error, I'm betting it's because of the string on this line not having the unicode prefix.

@chrippa

This comment has been minimized.

Show comment
Hide comment
@chrippa

chrippa May 12, 2014

Owner

Nevethless, given the kind of error, I'm betting it's because of the string on this line not having the unicode prefix.

I'm not so sure about that theory, it would only be the case if there was a error and it also contains unicode characters.

Unfortunately the full traceback was lost when the error was wrapped in a PluginError. If you could temporarily remove these lines (213-214) from src/livestreamer/plugin/plugin.py:

except (IOError, OSError, ValueError) as err:
    raise PluginError(err)

You should get the full traceback so we can figure out exactly where the error occured.

Owner

chrippa commented May 12, 2014

Nevethless, given the kind of error, I'm betting it's because of the string on this line not having the unicode prefix.

I'm not so sure about that theory, it would only be the case if there was a error and it also contains unicode characters.

Unfortunately the full traceback was lost when the error was wrapped in a PluginError. If you could temporarily remove these lines (213-214) from src/livestreamer/plugin/plugin.py:

except (IOError, OSError, ValueError) as err:
    raise PluginError(err)

You should get the full traceback so we can figure out exactly where the error occured.

@asermax

This comment has been minimized.

Show comment
Hide comment
@asermax

asermax May 17, 2014

Contributor

While investigating #364 I ran into this error (or something similar).
I configured my account to use French as prefered language, and since the subtitles were not available, a message in french was being thrown, causing the unicode error.
Neverthless, the error cascaded throught different methods defined on console.py. I updated #388 accordingly.
I asume it's the same error, since the OP mentioned he defined Spanish as his prefered language, which could as well have thrown some error with unicode chars. Still, I'm not completely sure since I tested with spanish as well and the error being thrown for missing subtitles was full ascii, so the OP should try to debug as instructed to confirm this.

Contributor

asermax commented May 17, 2014

While investigating #364 I ran into this error (or something similar).
I configured my account to use French as prefered language, and since the subtitles were not available, a message in french was being thrown, causing the unicode error.
Neverthless, the error cascaded throught different methods defined on console.py. I updated #388 accordingly.
I asume it's the same error, since the OP mentioned he defined Spanish as his prefered language, which could as well have thrown some error with unicode chars. Still, I'm not completely sure since I tested with spanish as well and the error being thrown for missing subtitles was full ascii, so the OP should try to debug as instructed to confirm this.

@dilworks

This comment has been minimized.

Show comment
Hide comment
@dilworks

dilworks May 17, 2014

OK, here is my shot at a debug attempt (took me some time to research as I'm not used to debug Python stuff):

PYTHONPATH=usr/local/lib/python2.7/dist-packages/ ./usr/local/bin/livestreamer -l debug --crunchyroll-username=USERNAME http://www.crunchyroll.com/soredemo-machi-wa-mawatteiru-manga-25/soredemo-machi-wa-mawatteiru-manga-25-pv-649865 mid
Enter Crunchyroll password: 
[cli][info] Found matching plugin crunchyroll for URL http://www.crunchyroll.com/soredemo-machi-wa-mawatteiru-manga-25/soredemo-machi-wa-mawatteiru-manga-25-pv-649865
[plugin.crunchyroll][debug] Creating session...
[plugin.crunchyroll][debug] Success!
[plugin.crunchyroll][info] Using saved credentials
Traceback (most recent call last):
  File "./usr/local/bin/livestreamer", line 9, in <module>
    load_entry_point('livestreamer==1.8.0', 'console_scripts', 'livestreamer')()
  File "/home/tomman/workbench/livestreamer/dist/usr/local/lib/python2.7/dist-packages/livestreamer_cli/main.py", line 782, in main
    handle_url()
  File "/home/tomman/workbench/livestreamer/dist/usr/local/lib/python2.7/dist-packages/livestreamer_cli/main.py", line 458, in handle_url
    streams = fetch_streams(plugin)
  File "/home/tomman/workbench/livestreamer/dist/usr/local/lib/python2.7/dist-packages/livestreamer_cli/main.py", line 375, in fetch_streams
    sorting_excludes=args.stream_sorting_excludes)
  File "/home/tomman/workbench/livestreamer/dist/usr/local/lib/python2.7/dist-packages/livestreamer/plugin/plugin.py", line 210, in get_streams
    ostreams = self._get_streams()
  File "/home/tomman/workbench/livestreamer/dist/usr/local/lib/python2.7/dist-packages/livestreamer/plugins/crunchyroll.py", line 171, in _get_streams
    'Media lookup error: {0}'.format(e.args[0]))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in position 25: ordinal not in range(128)

Weird, at the bottom of the stack dump I see no odd non-ANSI text...

dilworks commented May 17, 2014

OK, here is my shot at a debug attempt (took me some time to research as I'm not used to debug Python stuff):

PYTHONPATH=usr/local/lib/python2.7/dist-packages/ ./usr/local/bin/livestreamer -l debug --crunchyroll-username=USERNAME http://www.crunchyroll.com/soredemo-machi-wa-mawatteiru-manga-25/soredemo-machi-wa-mawatteiru-manga-25-pv-649865 mid
Enter Crunchyroll password: 
[cli][info] Found matching plugin crunchyroll for URL http://www.crunchyroll.com/soredemo-machi-wa-mawatteiru-manga-25/soredemo-machi-wa-mawatteiru-manga-25-pv-649865
[plugin.crunchyroll][debug] Creating session...
[plugin.crunchyroll][debug] Success!
[plugin.crunchyroll][info] Using saved credentials
Traceback (most recent call last):
  File "./usr/local/bin/livestreamer", line 9, in <module>
    load_entry_point('livestreamer==1.8.0', 'console_scripts', 'livestreamer')()
  File "/home/tomman/workbench/livestreamer/dist/usr/local/lib/python2.7/dist-packages/livestreamer_cli/main.py", line 782, in main
    handle_url()
  File "/home/tomman/workbench/livestreamer/dist/usr/local/lib/python2.7/dist-packages/livestreamer_cli/main.py", line 458, in handle_url
    streams = fetch_streams(plugin)
  File "/home/tomman/workbench/livestreamer/dist/usr/local/lib/python2.7/dist-packages/livestreamer_cli/main.py", line 375, in fetch_streams
    sorting_excludes=args.stream_sorting_excludes)
  File "/home/tomman/workbench/livestreamer/dist/usr/local/lib/python2.7/dist-packages/livestreamer/plugin/plugin.py", line 210, in get_streams
    ostreams = self._get_streams()
  File "/home/tomman/workbench/livestreamer/dist/usr/local/lib/python2.7/dist-packages/livestreamer/plugins/crunchyroll.py", line 171, in _get_streams
    'Media lookup error: {0}'.format(e.args[0]))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3' in position 25: ordinal not in range(128)

Weird, at the bottom of the stack dump I see no odd non-ANSI text...

@chrippa

This comment has been minimized.

Show comment
Hide comment
@chrippa

chrippa May 17, 2014

Owner

Thanks for investigating, it does indeed look like Crunchyroll may send localized error strings.

Owner

chrippa commented May 17, 2014

Thanks for investigating, it does indeed look like Crunchyroll may send localized error strings.

@chrippa

This comment has been minimized.

Show comment
Hide comment
@chrippa

chrippa May 17, 2014

Owner

Since I merged #388 you should now get a proper error message instead of that Python error.

However, as @asermax mentioned in #364 (comment) it seems Crunchyroll wants to serve you localized subtitles but they don't exist for these series you're having trouble with and you get an error.

Owner

chrippa commented May 17, 2014

Since I merged #388 you should now get a proper error message instead of that Python error.

However, as @asermax mentioned in #364 (comment) it seems Crunchyroll wants to serve you localized subtitles but they don't exist for these series you're having trouble with and you get an error.

@chrippa chrippa closed this May 17, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment