[BUG]AttributeError: 'NoneType' object has no attribute 'span'
See original GitHub issueBefore creating an issue I am on the latest version of pytube 11.0.2 my pip is at the latest version
Describe the bug So i can not download any videos using stream() method, I faced this issue yesterday as well and found a solution to change something in the cipher.py line 293, i did that and it worked for the rest of the day fine, when i woke up and tried to test it again the same error occurred even tho the line was changed and it is still changed as it was
To Reproduce Please provide the following information:
- ‘http://www.youtube.com/watch?v=UUGtYLqtaxc’
-
print(url) yt = YouTube(url) video = yt.streams.filter(only_audio=True).first() print(SAVE_PATH) out_file = video.download(SAVE_PATH)```
Expected behavior Well it should download the video!
Output
Traceback (most recent call last):
File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\discord\ext\commands\core.py", line 179, in wrapped
ret = await coro(*args, **kwargs)
File "J:\PycharmProjects\MyWorkProjects\work\SadisticFairyFolder\SadisticFairyCogs\music.py", line 496, in play
files = await loop.run_in_executor(None, self.download_spotify_urls, ctx.guild.id,
File "C:\Users\hp\AppData\Local\Programs\Python\Python39\lib\concurrent\futures\thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "J:\PycharmProjects\MyWorkProjects\work\SadisticFairyFolder\SadisticFairyCogs\music.py", line 82, in download_spotify_urls
video = yt.streams.filter(only_audio=True).first()
File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\pytube\__main__.py", line 292, in streams
return StreamQuery(self.fmt_streams)
File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\pytube\__main__.py", line 177, in fmt_streams
extract.apply_signature(stream_manifest, self.vid_info, self.js)
File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\pytube\extract.py", line 409, in apply_signature
cipher = Cipher(js=js)
File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\pytube\cipher.py", line 43, in __init__
self.throttling_plan = get_throttling_plan(js)
File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\pytube\cipher.py", line 387, in get_throttling_plan
raw_code = get_throttling_function_code(js)
File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\pytube\cipher.py", line 301, in get_throttling_function_code
code_lines_list = find_object_from_startpoint(js, match.span()[1]).split('\n')
AttributeError: 'NoneType' object has no attribute 'span'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\discord\ext\commands\bot.py", line 335, in invoke
await ctx.command.invoke(ctx)
File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\discord\ext\commands\core.py", line 916, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "J:\PycharmProjects\MyWorkProjects\work\.venv\lib\site-packages\discord\ext\commands\core.py", line 188, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'span'
System information Please provide the following information:
- Python 3.9.1 -Pytube 11.0.2
- pip install git+https://github.com/baxterisme/pytube
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:15
Top Results From Across the Web
pytube: AttributeError: 'NoneType' object has no attribute ' ...
The issue is that the regex expects a function with an argument, but I guess youtube added some src that includes non-paramterized functions....
Read more >[BUG] 'NoneType' object has no attribute 'span' · Issue #1218
You can do this by running python -m pip install git+https://github.com/pytube/pytube . Sometimes, the pypi library repository is not up to date ...
Read more >[Example code]-pytube: 'NoneType' object has no attribute 'span'
I try to follow pytube example for downloading video from YouTube: from pytube import YouTube video = YouTube('https://www.youtube.com/watch?v=BATOxzbVNno') ...
Read more >How do I fix : attributeerror: 'nonetype' object has no ...
When ever you get a problems that involves a message such as " 'nonetype' object has no attribute ..." it means the same...
Read more >attributeerror 'nonetype' object has no attribute 'text ...
You are getting the error because there are certain None values if you try to scrape directly. For eg: After the name Naksh...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is a duplicate of #1225. The temporary fix is to change the name from ’ name = “iha” ’ to ’ name = “jha” ’
Well “jha” no longer works lol, it worked at first and everything going smoothly but yeah, it’s temporary fix after all