0
0

More than 3 years have passed since last update.

pytubeで Getting KeyError: 'length_seconds' が出る方へ

Posted at

引用元

こちらの内容を元に作成しております。

変更内容

_main_.py のソースコード修正
length(self)
の戻り値修正

変更前
return self.player_config_args['length_seconds']

変更後
return self.player_config_args['player_response']['videoDetails']['lengthSeconds']

変更前

__main__.py

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

変更後

__main__.py

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

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0