h4kkr / pytubex Goto Github PK
View Code? Open in Web Editor NEWUnmaintained. Go away pls 😢 I'll maintain it another day.
License: Other
Unmaintained. Go away pls 😢 I'll maintain it another day.
License: Other
As you can see the whole title is Ailemize Hoş Geldin Mbwana Samatta! but the saved title or getting title is not same as the original.
Am I wrong or bug of the package?
Whenever I try to get a video with pytube.YouTube()
the title attribute always has missing characters in the beginning
I've tried
pytube.YouTube().title
pytube.YouTube().streams[0].title
pytube.YouTube().streams[0].default_file
from pytube import YouTube
yt = YouTube('https://www.youtube.com/watch?v=8HHlMhYQ-Zc')
Traceback (most recent call last):
File "/home/kkk/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
yt = YouTube('https://www.youtube.com/watch?v=8HHlMhYQ-Zc')
File "/home/kkk/anaconda3/lib/python3.7/site-packages/pytube/main.py", line 92, in init
self.descramble()
File "/home/kkk/anaconda3/lib/python3.7/site-packages/pytube/main.py", line 140, in descramble
apply_signature(self.player_config_args, fmt, self.js)
File "/home/kkk/anaconda3/lib/python3.7/site-packages/pytube/extract.py", line 225, in apply_signature
cipher = Cipher(js=js)
File "/home/kkk/anaconda3/lib/python3.7/site-packages/pytube/cipher.py", line 31, in init
var, _ = self.transform_plan[0].split(".")
ValueError: too many values to unpack (expected 2)
There are the following value error issues.
pytube3 seems to have no more updates, so I came to pytubeX.
Please tell me how to solve the above error.
This seems to have been fixed already on the main pytube repo, but pytubeX still has this error.
I'm the active maintainer and dev on spotify-downloader, we plan to make a shift to pytubeX from pytube3. Assuming we have bugs, how fast can we expect fixes and patches?
Traceback (most recent call last):
File "D:/pythonProject/main.py", line 15, in
YouTube(url).streams.get_highest_resolution().download(location)
File "D:\pythonProject\venv\lib\site-packages\pytube_main_.py", line 91, in init
self.prefetch()
File "D:\pythonProject\venv\lib\site-packages\pytube_main_.py", line 183, in prefetch
self.js_url = extract.js_url(self.watch_html)
File "D:\pythonProject\venv\lib\site-packages\pytube\extract.py", line 143, in js_url
base_js = get_ytplayer_config(html)["assets"]["js"]
KeyError: 'assets'
Process finished with exit code 1
this is the code:
from pytube import YouTube
from pytube import Playlist
import re
import os
import moviepy.editor as mp
link = str(input("\nEnter the Link of the Youtube Playlist you want to download in mp3 format: "))
playlist = Playlist(link)
playlist._video_regex = re.compile(r"\"url\":\"(/watch\?v=[\w-]*)")
print("Downloading...")
location = "C:/Users/User/Desktop/COMPROG/Comprog 2/Project Proposal/mp3 Download Location"
for url in playlist:
YouTube(url).streams.get_highest_resolution().download(location)
for file in os.listdir(location):
if re.search('mp4', file):
mp4_format = os.path.join(location, file)
mp3_format = os.path.join(location, os.path.splitext(file)[0] + '.mp3')
new_file = mp.AudioFileClip(mp4_format)
new_file.write_audiofile(mp3_format)
os.remove(mp4_format)
print("\nDownload completed!!")
FYI, the original creator of this project, Nick Ficano, is no longer maintaining it. I don't know who the new maintainer is, but there is information on this in the README of pytube:
https://github.com/nficano/pytube#24-july-2020-note-actively-soliciting-contributers
I'm using urllib3 and I get this error:
urllib.error.HTTPError: HTTP Error 410: Gone
I keep getting error when try to do this (the url is just an example):
from pytube import YouTube
yt = YouTube("https://www.youtube.com/watch?v=pXP2sgsfEPk")
Here's the error log:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\esteb\AppData\Local\Programs\Python\Python38\lib\site-packages\pytube\__main__.py", line 91, in __init__
self.prefetch()
File "C:\Users\esteb\AppData\Local\Programs\Python\Python38\lib\site-packages\pytube\__main__.py", line 183, in prefetch
self.js_url = extract.js_url(self.watch_html)
File "C:\Users\esteb\AppData\Local\Programs\Python\Python38\lib\site-packages\pytube\extract.py", line 143, in js_url
base_js = get_ytplayer_config(html)["assets"]["js"]
KeyError: 'assets'
>>> yt = YouTube("https://www.youtube.com/watch?v=RPMf1BKVDZg")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\esteb\AppData\Local\Programs\Python\Python38\lib\site-packages\pytube\__main__.py", line 91, in __init__
self.prefetch()
File "C:\Users\esteb\AppData\Local\Programs\Python\Python38\lib\site-packages\pytube\__main__.py", line 183, in prefetch
self.js_url = extract.js_url(self.watch_html)
File "C:\Users\esteb\AppData\Local\Programs\Python\Python38\lib\site-packages\pytube\extract.py", line 143, in js_url
base_js = get_ytplayer_config(html)["assets"]["js"]
KeyError: 'assets'
Extra Info:
I'm getting a 404 from youtube when I attempt to download adaptive streams. Progressive is fine, but those aren't the highest quality videos. Is there a work around for this one?
from pytube import YouTube
yt_video = YouTube("https://www.youtube.com/watch?v=xFSVoVOvaew")
yt_video.streams.filter(adaptive=True).order_by('resolution').first().download()
Returns
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/kaiser/tmp/pytube/pytube/streams.py", line 245, in download
bytes_remaining = self.filesize
File "/Users/kaiser/tmp/pytube/pytube/streams.py", line 156, in filesize
self._filesize = request.filesize(self.url)
File "/Users/kaiser/tmp/pytube/pytube/request.py", line 86, in filesize
return int(head(url)["content-length"])
File "/Users/kaiser/tmp/pytube/pytube/request.py", line 98, in head
response_headers = _execute_request(url, method="HEAD").info()
File "/Users/kaiser/tmp/pytube/pytube/request.py", line 27, in _execute_request
return urlopen(request) # nosec
File "/Users/kaiser/.pyenv/versions/3.8.2/lib/python3.8/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/Users/kaiser/.pyenv/versions/3.8.2/lib/python3.8/urllib/request.py", line 531, in open
response = meth(req, response)
File "/Users/kaiser/.pyenv/versions/3.8.2/lib/python3.8/urllib/request.py", line 640, in http_response
response = self.parent.error(
File "/Users/kaiser/.pyenv/versions/3.8.2/lib/python3.8/urllib/request.py", line 569, in error
return self._call_chain(*args)
File "/Users/kaiser/.pyenv/versions/3.8.2/lib/python3.8/urllib/request.py", line 502, in _call_chain
result = func(*args)
File "/Users/kaiser/.pyenv/versions/3.8.2/lib/python3.8/urllib/request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
RegexMatchError: get_ytplayer_config: could not find match for config_patterns
Anyone know any fixes? I'm not great with javascript or regex, though I could probably figure it out if I needed to.
Version: pytubeX==0.1.2
Code:
In [1]: from pytube import Playlist
In [2]: playlist = Playlist('https://www.youtube.com/playlist?list=PL326E728CF5AA4CBF')
In [3]: playlist.video_urls
Out[3]: []
I'm not sure if this is related to this issue.
Looks like youtube made an update to the javascript section. It seems that the regex for get_transform_plan in cipher.py is broken. This is the actual error. This wasn't like this yesterday and seemed to have started sometime today
File "C:\Workspace\Python\01_Projects\02_MaxIt\venv\lib\site-packages\pytube\cipher.py", line 31, in __init__
var, _ = self.transform_plan[0].split(".")
ValueError: too many values to unpack (expected 2)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.