If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

Can anyone point me in the right direction? AttributeError: 'NoneType' object has no attribute

BDuhbzBDuhbz Posts: 24Members, Plex Pass Plex Pass

I have some basic code that is not working and getting the following error:

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

I looked at the logs and this is what I'm getting:

2017-09-01 08:09:48,361 (1ae0) : DEBUG (runtime:88) - Sending packed state data (1090 bytes)
2017-09-01 08:09:48,361 (1ae0) : DEBUG (runtime:924) - Response: [500] 662 bytes
2017-09-01 08:09:59,963 (232c) : DEBUG (runtime:717) - Handling request GET /video/sportsarefree/createvideoclipobject?thumb=http%3A%2F%2Fi.imgur.com%2FagxSEPd.png&include_container=1&title=hbo2
2017-09-01 08:09:59,966 (232c) : DEBUG (runtime:49) - Received packed state data (1056 bytes)
2017-09-01 08:09:59,967 (232c) : DEBUG (runtime:814) - Found route matching /video/sportsarefree/createvideoclipobject
2017-09-01 08:09:59,973 (232c) : DEBUG (runtime:88) - Sending packed state data (1090 bytes)
2017-09-01 08:09:59,973 (232c) : DEBUG (runtime:924) - Response: [200] MediaContainer, 1575 bytes
2017-09-01 08:09:59,984 (14e8) : DEBUG (runtime:717) - Handling request GET /video/sportsarefree/createvideoclipobject?thumb=http%3A%2F%2Fi.imgur.com%2FcieuPb6.png&include_container=1&title=hbo
2017-09-01 08:09:59,986 (14e8) : DEBUG (runtime:49) - Received packed state data (1056 bytes)
2017-09-01 08:09:59,986 (14e8) : DEBUG (runtime:814) - Found route matching /video/sportsarefree/createvideoclipobject
2017-09-01 08:09:59,990 (14e8) : DEBUG (runtime:88) - Sending packed state data (1090 bytes)
2017-09-01 08:09:59,990 (14e8) : DEBUG (runtime:924) - Response: [200] MediaContainer, 1571 bytes
2017-09-01 08:10:01,005 (2668) : DEBUG (runtime:717) - Handling request GET /video/sportsarefree/createvideoclipobject?thumb=http%3A%2F%2Fi.imgur.com%2FcieuPb6.png&include_container=1&title=hbo
2017-09-01 08:10:01,009 (2668) : DEBUG (runtime:814) - Found route matching /video/sportsarefree/createvideoclipobject
2017-09-01 08:10:01,010 (19e0) : DEBUG (runtime:717) - Handling request GET /video/sportsarefree/createvideoclipobject?thumb=http%3A%2F%2Fi.imgur.com%2FcieuPb6.png&include_container=1&title=hbo
2017-09-01 08:10:01,016 (19e0) : DEBUG (runtime:49) - Received packed state data (1056 bytes)
2017-09-01 08:10:01,016 (2240) : DEBUG (runtime:717) - Handling request GET /video/sportsarefree/createvideoclipobject?thumb=http%3A%2F%2Fi.imgur.com%2FcieuPb6.png&include_container=1&title=hbo&includeBandwidths=1
2017-09-01 08:10:01,023 (19e0) : DEBUG (runtime:814) - Found route matching /video/sportsarefree/createvideoclipobject
2017-09-01 08:10:01,025 (2240) : DEBUG (runtime:814) - Found route matching /video/sportsarefree/createvideoclipobject
2017-09-01 08:10:01,028 (2668) : DEBUG (runtime:88) - Sending packed state data (114 bytes)
2017-09-01 08:10:01,030 (2668) : DEBUG (runtime:924) - Response: [200] MediaContainer, 1571 bytes
2017-09-01 08:10:01,040 (2240) : DEBUG (runtime:88) - Sending packed state data (114 bytes)
2017-09-01 08:10:01,042 (2240) : DEBUG (runtime:924) - Response: [200] MediaContainer, 1571 bytes
2017-09-01 08:10:01,042 (19e0) : DEBUG (runtime:88) - Sending packed state data (1090 bytes)
2017-09-01 08:10:01,043 (19e0) : DEBUG (runtime:924) - Response: [200] MediaContainer, 1571 bytes
2017-09-01 08:10:01,049 (1ae4) : DEBUG (runtime:717) - Handling request GET /video/sportsarefree/playvideo.m3u8?id=hbo&indirect=1&mediaInfo=%7B%22audio_channels%22%3A%202%2C%20%22protocol%22%3A%20%22hls%22%2C%20%22optimized_for_streaming%22%3A%20true%2C%20%22video_frame_rate%22%3A%20null%2C%20%22duration%22%3A%20null%2C%20%22height%22%3A%20720%2C%20%22width%22%3A%201280%2C%20%22container%22%3A%20%22mpegts%22%2C%20%22audio_codec%22%3A%20%22aac%22%2C%20%22aspect_ratio%22%3A%20null%2C%20%22video_codec%22%3A%20%22h264%22%2C%20%22video_resolution%22%3A%20%22720%22%2C%20%22bitrate%22%3A%20null%7D
2017-09-01 08:10:01,052 (1ae4) : DEBUG (runtime:814) - Found route matching /video/sportsarefree/playvideo.m3u8
2017-09-01 08:10:01,108 (1ae4) : DEBUG (networking:166) - Requesting 'http://sportsarefree.xyz/hbo'
2017-09-01 08:10:01,581 (1ae4) : CRITICAL (core:574) - Exception (most recent call last):
File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-b1d4aa012\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\components\runtime.py", line 843, in handle_request
result = f(**d)
File "C:\Users\me\AppData\Local\Plex Media Server\Plug-ins\sportsarefree.bundle\Contents\Code__init__.py", line 155, in PlayVideo
source = RE_SOURCE.search(page).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

The source code can be found here:

https://github.com/piplongrun/sportsarefree.bundle

Best Answer

Answers

  • czukowskiczukowski Posts: 131Members ✭✭✭

    @BDuhbz

    The message means you're trying to access a method or property that does not exist. It says attribute 'group', which you can spot in your code, source = RE_SOURCE.search(page).group(1), meaning there's no method named 'group' in the return value from RE_SOURCE.search(page) and 'NoneType' is a type of that return value. Apparently, the value of page variable doesn't match the pattern in RE_SOURCE so it returns nil. If this code used to work before, then there's a chance that there has been some change to the web page and the content cannot be parsed properly anymore.

  • BDuhbzBDuhbz Posts: 24Members, Plex Pass Plex Pass

    thank you.

    I got that I'm just trying to find out how I can get the new attributes from the site so that this code can work again.

  • BDuhbzBDuhbz Posts: 24Members, Plex Pass Plex Pass

    Thank you for clearing that up. The web page has definitely changed but should be static moving forward. I'm trying to teach myself how to do this so I'm a bit of a newb.

  • czukowskiczukowski Posts: 131Members ✭✭✭

    No problem. To be honest, I wouldn't consider a site where you have deal with JavaScript in order to get media URL (let alone obfuscated one like in this case) a good example for beginners, but it's still not too hard. If you run into troubles, just post here and I or somebody else will try to help.

Sign In or Register to comment.