[PYTHON] For those who get Getting Key Error:'length_seconds' on pytube

Quote source

https://github.com/nficano/pytube/issues/497

We have created it based on this content.

Changes

Main.py source code modification length(self) Return value correction

Change before return self.player_config_args['length_seconds']

After change return self.player_config_args['player_response']['videoDetails']['lengthSeconds']

Change before

__main__.py



    @property
    def length(self):
        """Get the video length in seconds.
        :rtype: str
        """
        return self.player_config_args['length_seconds']

After change

__main__.py



  @property
    def length(self):
        """Get the video length in seconds.
        :rtype: str
        """
        return self.player_config_args["player_response"]["videoDetails"]['lengthSeconds']

Recommended Posts

For those who get Getting Key Error:'length_seconds' on pytube
For those who can't install Python on Windows XP
Python techniques for those who want to get rid of beginners
Commentary on unbiasedness and consistency for those who don't like it
For those who don't have Keras or TensorFlow on GPU on macOS Sierra
AWS ~ For those who will use it ~
Getting Started with Processing and p5.js (for those who have done other languages) 02
Getting Started with Processing and p5.js (for those who have done other languages) 01
For those who want to learn Excel VBA and get started with Python
5 Reasons Processing is Useful for Those Who Want to Get Started with Python
Dart grammar for those who only know Python
For those who have done pip uninstall setuptools
Software training for those who start researching space
[For those who have mastered other programming languages] 10 points to catch up on Python points
For those who should have installed janome properly with Python but get an error