Pytube AttributeError: NoneType object has no attribute span

2024/10/9 18:24:35

Hi I have a problem with AttributeError: 'NoneType' object has no attribute 'span' I read on the StackOverflow a channel with this problem on this I found the potential solution but it still not working here was a advice to change a

this:

152: func_regex = re.compile(r"function\([^)]+\)")

to this

152: func_regex = re.compile(r"function\([^)]?\)")

but it is not working and I do not know how to solute it because A youtube Stil upgrading a platform and this error will be probably in the future too.

So I can Ask is some other method to download a youtube video.

from pytube.__main__ import YouTube 
from pytube.streams import Stream
def downloadVideo(link):video = pytube.YouTube(link)video.streams.get_highest_resolution().download()try:os.rename(video.streams.get_highest_resolution().default_filename, word +".mp4")except Exception:print("Expection in renamed file ")

Sorry for the bad indentation but the os.rename ... is too long for write it here

Answer

In pytube/cipher.py on line 293, change the line:

    name = re.escape(get_throttling_function_name(js))

to

    name = "iha"

Answered by czarnoff on the pytube github. If you have any bugs with pytube, I would recommend you check the issues section on the pytube github because bugs get fixed there the fastest.

https://en.xdnf.cn/q/118552.html

Related Q&A

GDB: ModuleNotFoundError: No module named _tkinter [duplicate]

This question already has answers here:Why does tkinter (or turtle) seem to be missing or broken? Shouldnt it be part of the standard library?(4 answers)Closed last year.So Im trying to debug my C co…

Why can the difference of different floating numbers be 0 in python? [duplicate]

This question already has answers here:Float to Int type conversion in Python for large integers/numbers(2 answers)Closed last year.Why is the result of below code 0 in python3? a = "4.1512940685…

twinx and sns.barplot seaborn are overlapping bars

I would like to use sns.seaborn to display the np.sum and the np.mean on 2 different axes (with ax2 = ax1.twinx() I assume). The probem I have is that the graphs are overlapped and not readable.Am I ap…

Cant get tensorflow on Anaconda [duplicate]

This question already has an answer here:TensorFlow Importing error ( Using Anaconda)(1 answer)Closed 2 years ago.I need tensorflow to run a guided project I did on Coursera, but I am not able to insta…

Extract number between text and | with RegEx Python

I want to extract the information between CVE and |, but only the first time that CVE appear in the txt. I have now the follow code:import re f = open (/Users/anna/PycharmProjects/extractData/DiarioOfi…

How to reset a loop that iterates over a set?

How can I reset a loop that iterates over a set? A common answer for iterating over a list is to reset the index you are using to access the list, however sets do not support indices. The point is to …

Can i set a threading timer with clock time to sync with cron job in python

I have a cron job that runs at 12, 12:30,1, 1:30. So every half hour intervals on the clock. I want to run a thread in my python code whenever the cron job runs.I have seen examples where to run a tim…

How do I make a simple countdown time in tkinter?

I am making a simple countdown timer in minutes. I cant seem to display the countdown in text label. Can someone help me?import tkinter as tk import timedef countdown(t):while t:mins, secs = divmod(t,…

Embed one pdf into another pdf using PyMuPDF

In need of help from learned people on this forum. I just want to embed one pdf file to another pdf file. So that when I go to the attachment section of the second file I can get to see and open the fi…

How to fix - TypeError: write() argument must be str, not None

Here is my code - sentence = input("Enter a sentence without punctuation") sentence = sentence.lower() words = sentence.split() pos = [words.index(s)+1 for s in words] hi = print("This s…