Search code examples
pythonpython-2.7youtubeaudio-streamingpafy

Pafy - Python 2.7


I am using Python 2.7 When I do this:

import pafy

video=pafy.new("https://www.youtube.com/watch?v=M9BNoNFKCBI")

I get the error:

Traceback (most recent call last):

File "pyshell#12", line 1, in module

video=pafy.new("https://www.youtube.com/watch?v=M9BNoNFKCBI")

File "C:\Python27\lib\site-packages\pafy\pafy.py", line 118, in new

from .backend_internal import InternPafy as Pafy

File "C:\Python27\lib\site-packages\pafy\backend_internal.py", line 21, in module>

from urlparse import parse_qs, unquote_plus

ImportError: cannot import name unquote_plus

Please Help! Thanks in advance!


Solution

  • There is a bug in the current version.

    Go to https://raw.githubusercontent.com/mps-youtube/pafy/develop/pafy/backend_internal.py

    Copy all, then go to your Python27 directory, go to pafy directory (should be something like Lib/site-packages/pafy, open backend_internal.py in a text editor, delete everything then paste the updated version from the git repo and save.

    Should work now.