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