Giter Site home page Giter Site logo

shekharchander / tube_dl Goto Github PK

View Code? Open in Web Editor NEW
19.0 1.0 10.0 688 KB

Youtube video downloader and info extractor for python.

License: MIT License

Python 100.00%
youtube-video streams captions audio mp3 python playlist live-streams youtube youtube-api youtube-downloader

tube_dl's Issues

KeyError when downloading

Traceback (most recent call last):
  File "C:\Users\fixin\PycharmProjects\TTS\main.py", line 58, in <module>
    save_to_file()
  File "C:\Users\fixin\PycharmProjects\TTS\main.py", line 52, in save_to_file
    Youtube(keys[key]).formats.filter_by(only_audio=True).first().download(convert="mp3")
  File "C:\Users\fixin\PycharmProjects\TTS\venv\lib\site-packages\tube_dl\__main__.py", line 73, in __init__
    self.description = ''.join([i["text"] for i in extraDetails[1]['videoSecondaryInfoRenderer']['description']["runs"]])
KeyError: 'description'

path separators are os dependent

Nice package! Tried under linux and I had to modify formats.py.

final_path = f'{path}\{file_name}.{extension}'
to:
final_path = f'{path}' + os.path.sep + f'{file_name}.{extension}'

I'm sure there are other places that the separator should be fixed.

Tube_dl library import isn't recognized!

Python version>> 3.10.5

Command used for installation: "pip install tube_dl".

The tube_dl library was installed, but at the time of import it is not recognized, I imported the same as the usage tutorial, but it is not found or recognized, the command: "from tube_dl import Youtube" I did a search for cmd with the command "pip3 list" and it really said that it was installed, but when looking for the folder in tube_dl on venv, it is not, please help me, I need this library a lot.

Error while using the tool. KeyError: 'runs'

I tried the following command:

print(Youtube('link here'))

and it returned back with the following error:

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.8/site-packages/tube_dl/main.py", line 64, in init
self.subscribers=extraDetails[1]['videoSecondaryInfoRenderer']["owner"]["videoOwnerRenderer"]["subscriberCountText"]["runs"][0]
KeyError: 'runs'

DO NOT fetch full list of video in the playlist (max 200 videos)

It seems that after the first time using Token extracted from HTML, the author continues to use that token while the token already changed. To fix this problem, update to use new token to get full of playlist.

In python file containing class Playlist

In function:

   def fetch_continuation(self, html):
          #same code
          return data

In function:

def __init__(self, url: str, start: int = None, end: int = None):
        # same code
        if total_count > 100:
            start_html = html
            for i in range(0, total_count//100):
                start_html = self.fetch_continuation(start_html)
            # same code

Hope this help.

unable to get number of likes from video

import tube_dl
yt = tube_dl.Youtube("https://www.youtube.com/watch?v=eZYtnzODpW4")
print(yt.likes)  
File "/home/matteo/.local/lib/python3.8/site-packages/tube_dl/__main__.py", line 75, in __init__
    self.likes, self.dislikes = [i.strip() for i in extraDetails["sentimentBar"]["sentimentBarRenderer"]["tooltip"].split('/')]
KeyError: 'sentimentBar'

KeyError: 'sentimentBar'

I'm downloading a video, https://m.youtube.com/watch?v=HhV_Y8C5YKo, and get the following error:

Traceback (most recent call last):
  File "main.py", line 52, in <module>
    download_audio(lin)
  File "main.py", line 27, in download_audio
    yt = Youtube(url).formats.filter_by(only_audio=True)[0]
  File "/Users/jeff/Documents/Projects/pytubedl/venv/lib/python3.8/site-packages/tube_dl/__main__.py", line 75, in __init__
    self.likes, self.dislikes = [i.strip() for i in extraDetails["sentimentBar"]["sentimentBarRenderer"]["tooltip"].split('/')]

AttributeError: 'Youtube' object has no attribute 'json_file'

code

from tube_dl import Youtube
Youtube("https://youtube.com/watch?v=R2j46bHm6zw&list=RDAMVMd4HYhxlsj5k").Formats()

result

FileNotFoundError                         Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/tube_dl/__main__.py](https://localhost:8080/#) in __init__(self, vid)
     31         try:
---> 32             self.json_file = load(open(cwd+"/tube_dl_config.json", "rb"))
     33         except FileNotFoundError:

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.10/dist-packages/tube_dl/tube_dl_config.json'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
2 frames
[/usr/local/lib/python3.10/dist-packages/tube_dl/__main__.py](https://localhost:8080/#) in get_js(self)
    107         js_file = get(js_url).text
    108         data = Decipher(js_file, process=True).get_full_function()
--> 109         self.json_file['js'] = data
    110         open(cwd+'/tube_dl_config.json', 'w').write(dumps(self.json_file))
    111         return data

AttributeError: 'Youtube' object has no attribute 'json_file'

best regards

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.