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

KeyError: 'dashmpd' #475

Closed
serain opened this issue Apr 16, 2016 · 10 comments

Comments

Projects
None yet
6 participants
@serain
Copy link

commented Apr 16, 2016

I used mps-youtube for a while but then stopped when I switched to Ubuntu 14.04 and could not longer get it working. Tried updating it again today to see if it works, but sadly it doesn't. I'm getting a KeyError: 'dashmpd'. Stack trace below with more info at the end.

Exception in thread Thread-1:                                                                                                                                                                                                                                                     
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.4/dist-packages/mps_youtube/main.py", line 2475, in _preload
    stream = streams.select(streams.get(song), audio=not video, m4a_ok=m4a)
  File "/usr/local/lib/python3.4/dist-packages/mps_youtube/streams.py", line 50, in get
    p = get_pafy(vid, force=force, callback=callback)
  File "/usr/local/lib/python3.4/dist-packages/mps_youtube/util.py", line 175, in get_pafy
    p = pafy.new(item.ytid, callback=callback_fn)
  File "/usr/local/lib/python3.4/dist-packages/pafy/pafy.py", line 125, in new
    return Pafy(url, basic, gdata, signature, size, callback, ydl_opts)
  File "/usr/local/lib/python3.4/dist-packages/pafy/backend_internal.py", line 47, in __init__
    super(InternPafy, self).__init__(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/pafy/backend_shared.py", line 95, in __init__
    self._fetch_basic()
  File "/usr/local/lib/python3.4/dist-packages/pafy/backend_internal.py", line 94, in _fetch_basic
    self.callback)
  File "/usr/local/lib/python3.4/dist-packages/pafy/backend_internal.py", line 433, in get_js_sm
    dash_url = stream_info['dashmpd']
KeyError: 'dashmpd'

Traceback (most recent call last):                                                                                                                                                                                                                                                
  File "/usr/local/bin/mpsyt", line 9, in <module>
    load_entry_point('mps-youtube==0.2.6', 'console_scripts', 'mpsyt')()
  File "/usr/local/lib/python3.4/dist-packages/mps_youtube/main.py", line 3695, in main
    if matchfunction(i.function, i.regex, userinput):
  File "/usr/local/lib/python3.4/dist-packages/mps_youtube/main.py", line 3644, in matchfunction
    func(*matches)
  File "/usr/local/lib/python3.4/dist-packages/mps_youtube/main.py", line 2427, in play
    play_range(songlist, shuffle, repeat, override)
  File "/usr/local/lib/python3.4/dist-packages/mps_youtube/main.py", line 2519, in play_range
    returncode = playsong(song, override=override)
  File "/usr/local/lib/python3.4/dist-packages/mps_youtube/main.py", line 1138, in playsong
    streams.get(song, force=failcount, callback=screen.writestatus)
  File "/usr/local/lib/python3.4/dist-packages/mps_youtube/streams.py", line 50, in get
    p = get_pafy(vid, force=force, callback=callback)
  File "/usr/local/lib/python3.4/dist-packages/mps_youtube/util.py", line 175, in get_pafy
    p = pafy.new(item.ytid, callback=callback_fn)
  File "/usr/local/lib/python3.4/dist-packages/pafy/pafy.py", line 125, in new
    return Pafy(url, basic, gdata, signature, size, callback, ydl_opts)
  File "/usr/local/lib/python3.4/dist-packages/pafy/backend_internal.py", line 47, in __init__
    super(InternPafy, self).__init__(*args, **kwargs)
  File "/usr/local/lib/python3.4/dist-packages/pafy/backend_shared.py", line 95, in __init__
    self._fetch_basic()
  File "/usr/local/lib/python3.4/dist-packages/pafy/backend_internal.py", line 94, in _fetch_basic
    self.callback)
  File "/usr/local/lib/python3.4/dist-packages/pafy/backend_internal.py", line 433, in get_js_sm
    dash_url = stream_info['dashmpd']
KeyError: 'dashmpd'

Some more info about my system:

~ $ uname -ar
Linux user-HP-EliteBook-840-G2 4.2.0-30-generic #36~14.04.1-Ubuntu SMP Fri Feb 26 18:49:23 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
~ $ pip3 --version
pip 1.5.4 from /usr/lib/python3/dist-packages (python 3.4)
~ $ python3 --version
Python 3.4.3
@ids1024

This comment has been minimized.

Copy link
Member

commented Apr 16, 2016

Install youtube-dl with pip3 install youtube-dl.

@serain

This comment has been minimized.

Copy link
Author

commented Apr 16, 2016

@ids1024 Thanks!! this issue can be closed then.
I'm surprised it's not mentioned as a dependency in the README?

@ids1024

This comment has been minimized.

Copy link
Member

commented Apr 16, 2016

mps-youtube/pafy#140

It is supposed to be an optional dependency of pafy, which can use either youtube-dl or it's own code as a backend. Changes on YouTube have broken the internal backend, which needs to be fixed at some point.

@n1trux

This comment has been minimized.

Copy link

commented Jun 4, 2016

I installed youtube_dl through Debian's package manager.

After searching for /dubstep rock and selecting Nirvana - Smells Like Teen Spirit (RIOT 87 Remix) [Dubstep/Rock] the player reproducibly crashes.

When opening the video manually with mpv or downloading it with youtube-dl, it works well.

EDIT: complete strace while selecting the video here: https://gist.github.com/n1trux/2859092ad15e900bd2ae245a04d4c0f3

EDIT2: version info:

mpsyt version  : 0.2.5 
   notes       : released 1 June 2015
pafy version   : 0.3.80
Python version : 3.5.1+ (default, May  9 2016, 11:00:17) 
[GCC 5.3.1 20160429]
Processor      : 
Machine type   : x86_64
Architecture   : 64bit, ELF
Platform       : Linux-4.5.0-2-amd64-x86_64-with-debian-stretch-sid
sys.stdout.enc : UTF-8
default enc    : utf-8
Config dir     : /home/shiki/.config/mps-youtube
env:TERM       : xterm
env:SHELL      : /bin/bash
env:LANG       : de_DE.utf8
@ids1024

This comment has been minimized.

Copy link
Member

commented Jun 4, 2016

I installed youtube_dl through Debian's package manager.

The debian package is for youtube-dl is python 2 (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=723990), while mpsyt uses python 3. You should install youtube-dl using pip3.

@gaetanbahl

This comment has been minimized.

Copy link

commented Jul 1, 2016

Had same issue, solved by running sudo pip3 install youtube-dl

@ids1024

This comment has been minimized.

Copy link
Member

commented Aug 16, 2016

I think I have the internal backend fixed in pafy's develop branch, though the youtube-dl backend is still recommended.

If anyone would like to test it, I would appreciate that.

@ids1024

This comment has been minimized.

Copy link
Member

commented Aug 18, 2016

Pafy 0.5.2 has been released with this fix. Closing.

@ids1024 ids1024 closed this Aug 18, 2016

@thecountoftuscany

This comment has been minimized.

Copy link

commented Jun 12, 2018

I am facing the same issue. However, installing youtube-dl with pip3 did not solve it for me. Still getting the same error. The full error is given below:

Exception in thread Thread-1:                                                                                                                           
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3/dist-packages/mps_youtube/main.py", line 3497, in preload
    stream = get_streams(song)
  File "/usr/lib/python3/dist-packages/mps_youtube/main.py", line 345, in get_streams
    p = get_pafy(vid, force=force, callback=callback)
  File "/usr/lib/python3/dist-packages/mps_youtube/main.py", line 314, in get_pafy
    p = pafy.new(item.ytid, callback=callback_fn)
  File "/usr/lib/python3/dist-packages/pafy/pafy.py", line 148, in new
    return Pafy(url, basic, gdata, signature, size, callback)
  File "/usr/lib/python3/dist-packages/pafy/pafy.py", line 866, in __init__
    self.fetch_basic()
  File "/usr/lib/python3/dist-packages/pafy/pafy.py", line 892, in fetch_basic
    smaps, js_url, mainfunc, dashurl = get_js_sm(self.videoid)
  File "/usr/lib/python3/dist-packages/pafy/pafy.py", line 481, in get_js_sm
    dash_url = stream_info['dashmpd']
KeyError: 'dashmpd'

Exception in thread Thread-2:                                                                                                                           
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3/dist-packages/mps_youtube/main.py", line 3497, in preload
    stream = get_streams(song)
  File "/usr/lib/python3/dist-packages/mps_youtube/main.py", line 345, in get_streams
    p = get_pafy(vid, force=force, callback=callback)
  File "/usr/lib/python3/dist-packages/mps_youtube/main.py", line 314, in get_pafy
    p = pafy.new(item.ytid, callback=callback_fn)
  File "/usr/lib/python3/dist-packages/pafy/pafy.py", line 148, in new
    return Pafy(url, basic, gdata, signature, size, callback)
  File "/usr/lib/python3/dist-packages/pafy/pafy.py", line 866, in __init__
    self.fetch_basic()
  File "/usr/lib/python3/dist-packages/pafy/pafy.py", line 892, in fetch_basic
    smaps, js_url, mainfunc, dashurl = get_js_sm(self.videoid)
  File "/usr/lib/python3/dist-packages/pafy/pafy.py", line 481, in get_js_sm
    dash_url = stream_info['dashmpd']
KeyError: 'dashmpd'

Traceback (most recent call last):                                                                                                                      
  File "/usr/bin/mpsyt", line 9, in <module>
    load_entry_point('mps-youtube==0.2.5', 'console_scripts', 'mpsyt')()
  File "/usr/lib/python3/dist-packages/mps_youtube/main.py", line 4780, in main
    if matchfunction(k, v, userinput):
  File "/usr/lib/python3/dist-packages/mps_youtube/main.py", line 4680, in matchfunction
    func(*matches)
  File "/usr/lib/python3/dist-packages/mps_youtube/main.py", line 3450, in play
    play_range(songlist, shuffle, repeat, override)
  File "/usr/lib/python3/dist-packages/mps_youtube/main.py", line 3543, in play_range
    returncode = playsong(song, override=override)
  File "/usr/lib/python3/dist-packages/mps_youtube/main.py", line 2104, in playsong
    get_streams(song, force=failcount, callback=writestatus)
  File "/usr/lib/python3/dist-packages/mps_youtube/main.py", line 345, in get_streams
    p = get_pafy(vid, force=force, callback=callback)
  File "/usr/lib/python3/dist-packages/mps_youtube/main.py", line 314, in get_pafy
    p = pafy.new(item.ytid, callback=callback_fn)
  File "/usr/lib/python3/dist-packages/pafy/pafy.py", line 148, in new
    return Pafy(url, basic, gdata, signature, size, callback)
  File "/usr/lib/python3/dist-packages/pafy/pafy.py", line 866, in __init__
    self.fetch_basic()
  File "/usr/lib/python3/dist-packages/pafy/pafy.py", line 892, in fetch_basic
    smaps, js_url, mainfunc, dashurl = get_js_sm(self.videoid)
  File "/usr/lib/python3/dist-packages/pafy/pafy.py", line 481, in get_js_sm
    dash_url = stream_info['dashmpd']
KeyError: 'dashmpd'
@albjeremias

This comment has been minimized.

Copy link

commented Jul 4, 2018

I still have this issue on my ubuntu-mate xenial aarch64
Linux teres 3.10.104 #1 SMP PREEMPT Tue Nov 7 10:19:28 EET 2017 aarch64 aarch64 aarch64 GNU/Linux

I could fix it by removing youtube-dl and mps-youtube
$ sudo apt remove youtube-dl mps-youtube

and then reinstalling usingpip3

$ sudo apt install python3-pip

$ pip3 install mps-youtube youtube-dl

@ritiek ritiek referenced this issue Aug 20, 2018

Closed

keyerror dashmpd #861

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.