Giter Site home page Giter Site logo

pytubex's People

Contributors

cafeepy avatar dependabot[bot] avatar e9000000000 avatar h4kkr avatar hadipash avatar kpister avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pytubex's Issues

pytube.YouTube(...) title attribute has missing charecters

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
    but none of them worked, there always is a missing chunk in the beginning of title

ValueError: too many values to unpack (expected 2)

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.

These errors shows up(sometimes) whenever i download youtube playlist

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!!")

HTTP Error 410

I'm using urllib3 and I get this error:
urllib.error.HTTPError: HTTP Error 410: Gone

KeyError: 'assets'

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:

  • OS: Microsoft Windows [Versión 10.0.19041.572]
  • Python version: 3.8.5
  • PyTubeX version: 0.1.4 (Problems still from 0.1.2)

404 on download

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

New youtube update raises RegEx error

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.

Playlist is empty

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.

PyTube Broken (Cipher Regex)

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.