question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG]AttributeError: 'NoneType' object has no attribute 'span'

See original GitHub issue

Before 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:

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:open
  • Created 2 years ago
  • Reactions:2
  • Comments:15

github_iconTop GitHub Comments

6reactions
AlekKCodecommented, Feb 3, 2022

This is a duplicate of #1225. The temporary fix is to change the name from ’ name = “iha” ’ to ’ name = “jha” ’

4reactions
yAmIZErO31commented, Feb 4, 2022

Well “jha” no longer works lol, it worked at first and everything going smoothly but yeah, it’s temporary fix after all

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found