-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[BUG] 'NoneType' object has no attribute 'span' #1218
Comments
I'm not sure why all of my code is formatted so badly but happy to make edits if I can figure out how to fix it |
Same error AttributeError: 'NoneType' object has no attribute 'span' |
There are pull requests that fix this issue but idk why they are not merged yet. |
I've tried manually applying the fix suggested in the original bug filing, but the issue is persisting. I'm not sure if the issue occurring today is related to the earlier issue that PRs have been created for. |
Latest error is in cypher.py not parser.py |
@headkaze yes. error in cypher.py . tryed using |
the regex search is failing, maybe youtube has changed the javascript. |
Yes, the regex is searching for a throttling function |
I think the javascipt changed. If you search for Bpa, you don't find a function. Instead you get
Thus Bpa is an array with the function "iha" in location zero . If you use iha for the name, you get a function. I kludged line 293 of cipher.py to go from
to
And I now its working. I'm not sure how to correctly change the code yet, but if I figure out a proper patch I'll post it. |
works... |
thanks broooo |
i am also facing Same error AttributeError: 'NoneType' object has no attribute 'span' |
thank you bro it works!!!!! |
Good Work! |
It works you should upload it |
This doesn't work for me tho. This is what I get when I use name="iha"
|
is pytube is working for anyone, Please share pytube patched branch so that we will be able to install through pip |
I created a fork with the earlier proposed solution if anyone need it. |
Not working ERROR: Cannot unpack file /tmp/pip-unpack-oah_1k8u/pytube (downloaded from /tmp/pip-req-build-apkmcmlb, content-type: text/html; charset=utf-8); cannot detect archive format |
Strange. It's working for me. I used command |
and this video after using your code doesnot work |
@hunterhawley please fix your formatting. There was a change in youtube's javascript. yt-dlp has already been fixed here is this is indeed the same issue. |
This worked |
* pytube/pytube#1218 (comment) Should take care of missing regex match.
It worked! Thanks so much! |
Its working bro !!!!Thanx |
This fix is not working for this video https://www.youtube.com/watch?v=twtGL8WbllM |
@rishabh3354 it works. Show us the error you get? I'm not getting any error. |
Thanks! It works for me!!! |
Error is when i try to download |
@rishabh3354 this has nothing to do with this issue. |
Bro I am not able to download . https://github.com/glubsy/pytube@nfunc_regex_patch |
@rishabh3354 this patch works perfectly well, I just tested it now - BTW, thank you @glubsy - I use it directly in my repo https://github.com/rmerzouki/pytube. |
It is failing for Some streams objects HOW TO REPLICATE video link this stream obj is failing which in no.8 in my case (itag="160").
ERROR OUTPUT
|
@glubsy no doubt, here we got full of immature programmers who claims to be superb😂 |
the specific itag you are trying to use has no filesize value, therefore you are getting KeyError: 'content-length'. i suppose, this will get the job done
and please be respectful to others, |
you have proved yourself, i am not expecting answers from you btw |
* Fix regex to find throttle function name The javascript now stores the throttling function name in an array. Fix #1218 * Fix array parsing Strip whitespaces around symbol names for future-proofing. The variable name might be "b" right now, but it could change in the future.
this is not fixed, dont close it bro.. dont make us fool. lol |
Any expectation on when we are going to see this released in PyPI? |
Hey @rishabh3354 please don't be rude to other members of the repo - there is a ban functionality. @eliorc Hey want to confirm the question -- is the fix working but not released in PyPI? |
Yes @RONNCC , I've installed from the latest on master and it works fine for me |
@eliorc thanks for update -- just released on PyPi |
The Yes, I have tried a fresh pip install of the release from a few hours ago. |
Just did a fresh pip, pytube, pydub reinstall and this issue has gone away. |
Thank you! It did help, especially explanation. Name "iha" did not work for me, but "yha" worked well. I believe it is case by case (that why originally it was determined by function). So, just print "js" variable to see its content before name and search for "Spa" in the text, you will find name of function you need. In my case it was "Spa=[yha]". Then, just set "name" variable to this value, in my case "name = 'yha'". |
@VLomonovskis could you submit a patch :-) |
Thanks! |
Hello guys,
in your CMD |
Hello guys!
I tried everything you mentioned here but nothing seems to work for me. My code worked perfectly a few months ago, but now I am getting an error The error appears on lines 73, 78, 81 Does anyone know how to fix this? PS: Sorry for my bad English and bad coding, I am a self-learner. pip 22.0.4 |
I still have the problem `pytube https://www.youtube.com/watch?v=EbHxWU52ZH0 During handling of the above exception, another exception occurred: Traceback (most recent call last): |
hey @shameerariff -- would you mind submitting a patch to fix the above ;) |
Hi @RONNCC It was already applied in the git as follows def get_throttling_function_name(js: str) -> str:
|
Before creating an issue
Please confirm that you are on the latest version of pytube by installing from the source.
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, and your issue may have been fixed already!
Describe the bug
I have been running PyTube at different points today with success and fast downloads, but as of about 30 minutes ago I started to get this when I would run it:
'NoneType' object has no attribute 'span'
To Reproduce
I have tried on these two links, both of which were working earlier today:
-https://www.youtube.com/watch?v=twtGL8WbllM&ab_channel=HarritonRams
-https://www.youtube.com/watch?v=mA_3LkF_Cdo&ab_channel=IndianaSRN
Here is the code sample where it is being used:
def download_youtube_video(row, game_id): filename = game_id + ".mp4" try: YouTube(row[0]).streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first().download(filename=filename) upload_successful = True except Exception as e: print(e) print("HEY, LOOK HERE") print("I'VE GOT SOME BAD NEWS, SADLY") print("YOU'RE GOING TO HAVE TO DOWNLOAD AND UPLOAD THIS ONE MANUALLY") print(row[0]) print(game_id) print("I TRIED TWO DIFFERENT YOUTUBE DOWNLOADER PACKAGES, BLAME THOSE F**** OVER AT GOOGLE FOR THIS")
Expected behavior
I expected the video to be downloaded in the same directory as my python script as it was earlier today.
Output
Traceback (most recent call last): File "test.py", line 3, in <module> YouTube("https://www.youtube.com/watch?v=mA_3LkF_Cdo&ab_channel=IndianaSRN").streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first().download(filename="hello.mp4") File "/Users/hunterhawley/Library/Python/3.7/lib/python/site-packages/pytube/__main__.py", line 292, in streams return StreamQuery(self.fmt_streams) File "/Users/hunterhawley/Library/Python/3.7/lib/python/site-packages/pytube/__main__.py", line 177, in fmt_streams extract.apply_signature(stream_manifest, self.vid_info, self.js) File "/Users/hunterhawley/Library/Python/3.7/lib/python/site-packages/pytube/extract.py", line 409, in apply_signature cipher = Cipher(js=js) File "/Users/hunterhawley/Library/Python/3.7/lib/python/site-packages/pytube/cipher.py", line 43, in __init__ self.throttling_plan = get_throttling_plan(js) File "/Users/hunterhawley/Library/Python/3.7/lib/python/site-packages/pytube/cipher.py", line 387, in get_throttling_plan raw_code = get_throttling_function_code(js) File "/Users/hunterhawley/Library/Python/3.7/lib/python/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'
System information
Please provide the following information:
python -m pip install pytube
but before posting it waspython -m pip install git+https://github.com/pytube/pytube
The text was updated successfully, but these errors were encountered: