Skip to content
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

Exception while searching #26

Closed
bigspider opened this issue Feb 14, 2014 · 4 comments
Closed

Exception while searching #26

bigspider opened this issue Feb 14, 2014 · 4 comments
Assignees

Comments

@bigspider
Copy link

If I search ".stonehenge", results are given but this stacktrace is shown:

Search results for stonehenge
> Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 808, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 761, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/bin/mpsyt", line 1554, in preload
    song['pafy'] = get_streams(song, future=True)
  File "/usr/local/bin/mpsyt", line 1021, in get_streams
    p = pafy.new(song['link'])
  File "/usr/local/lib/python2.7/dist-packages/pafy.py", line 255, in new
    return Pafy(url, callback=callback)
  File "/usr/local/lib/python2.7/dist-packages/pafy.py", line 548, in __init__
    self.streams = [Stream(sm, self.title, js) for sm in smap]
  File "/usr/local/lib/python2.7/dist-packages/pafy.py", line 281, in __init__
    self.resolution = g.itags[self.itag][0]
KeyError: '83'

Then, if I try to play an item from the search results, this is shown and the program quits:

Traceback (most recent call last):E...                                      
  File "/usr/local/bin/mpsyt", line 2069, in <module>
    main()
  File "/usr/local/bin/mpsyt", line 2047, in main
    globals()[func](*matches)
  File "/usr/local/bin/mpsyt", line 1514, in play
    play_range(songlist, shuffle, repeat, override)
  File "/usr/local/bin/mpsyt", line 1593, in play_range
    playsong(song, override=override)
  File "/usr/local/bin/mpsyt", line 1035, in playsong
    song['pafy'] = get_streams(song, force=failcount)
  File "/usr/local/bin/mpsyt", line 1017, in get_streams
    p = pafy.new(song['link'], callback=writestatus)
  File "/usr/local/lib/python2.7/dist-packages/pafy.py", line 255, in new
    return Pafy(url, callback=callback)
  File "/usr/local/lib/python2.7/dist-packages/pafy.py", line 548, in __init__
    self.streams = [Stream(sm, self.title, js) for sm in smap]
  File "/usr/local/lib/python2.7/dist-packages/pafy.py", line 281, in __init__
    self.resolution = g.itags[self.itag][0]
KeyError: '83'

I'm using v0.01.31.

@np1 np1 added the bug label Feb 14, 2014
@np1 np1 self-assigned this Feb 14, 2014
@np1
Copy link
Contributor

np1 commented Feb 14, 2014

Thanks for reporting this, I get the same error. It's due to pafy not recognising one of the formats available for the first result of that search. I will update pafy soon to correct this.

@np1
Copy link
Contributor

np1 commented Feb 14, 2014

I have added the missing format in pafy (itag 83): https://github.com/np1/pafy/commit/9f89f5cda20f951642111f4a88bc405be50e51ff

It will go out with the next release.

@bigspider
Copy link
Author

Thank you!

@np1
Copy link
Contributor

np1 commented Feb 17, 2014

mpsyt 0.01.32 and pafy 0.3.35 (which contains the fix for this issue) have been pushed to PyPI and Github.

A pip upgrade of mps-youtube should upgrade them both:
sudo pip install mps-youtube --upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants