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

AttributeError: 'NoneType' object has no attribute 'group' #282

Open
rapierbit opened this issue Dec 30, 2020 · 2 comments
Open

AttributeError: 'NoneType' object has no attribute 'group' #282

rapierbit opened this issue Dec 30, 2020 · 2 comments

Comments

@rapierbit
Copy link

rapierbit commented Dec 30, 2020

I figure this has to be simple issue, but I'm not finding a reference to it anywhere.

I'm trying to use pafy on a Raspberry Pi 4, originally booted with Buster from the summer (8/20?) but apt-get upgraded since.

Then sudo apt-get install python3-pafy.

I can't do the simplest example in the documentation without the error cited on the subject line:

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

And then the error gets thrown (shown below). It's unclear to me which offending call is returning an object of 'NoneType' that then further has no attribute 'group'.

I note that the latest pafy is 0.5.5 but apt-get installs 0.5.2-2. I'm not a big user of pip but would that be my recommended approach here? Anyone know if this is a known issue, or am I missing something else?

======================================================

Traceback (most recent call last):
File "<pyshell#2>", line 1, in
video = pafy.new(url)
File "/usr/lib/python3/dist-packages/pafy/pafy.py", line 122, in new
return Pafy(url, basic, gdata, size, callback, ydl_opts)
File "/usr/lib/python3/dist-packages/pafy/backend_internal.py", line 42, in _$
super(InternPafy, self).init(*args, kwargs)
File "/usr/lib/python3/dist-packages/pafy/backend_shared.py", line 95, in __i$
self._fetch_basic()
File "/usr/lib/python3/dist-packages/pafy/backend_internal.py", line 50, in _$
allinfo = get_video_info(self.videoid, self.callback)
File "/usr/lib/python3/dist-packages/pafy/backend_internal.py", line 268, in $
sts = re.search(r'sts"\s
:\s
(\d+)', embed_webpage).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

@mango16384
Copy link

May I ask you that is the problem solved?
I'm also having this issue with pafy 0.5.5 on python 3.6.7

@jankais3r
Copy link

This issue is caused by pafy's internal backend being outdated and having troubles with parsing the current YouTube video page. backend_internal.py received last update in November 2018. As mentioned in pafy.py:

youtube-dl not found; you can use the internal backend by setting the environmental variable PAFY_BACKEND to "internal". It is not enabled by default because it is not as well maintained as the youtube-dl backend.

The issue can be solved by installing youtube-dl. You have to install youtube-dl via pip, not via apt.

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

3 participants