Skip to content

Commit

Permalink
[peertube] only call description endpoint if necessary (ytdl-org#29383)
Browse files Browse the repository at this point in the history
  • Loading branch information
B0pol authored Jul 1, 2021
1 parent 7fb9564 commit a803582
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions youtube_dl/extractor/peertube.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,15 +569,15 @@ def _real_extract(self, url):
formats.append(f)
self._sort_formats(formats)

full_description = self._call_api(
host, video_id, 'description', note='Downloading description JSON',
fatal=False)
description = video.get('description')
if len(description) >= 250:
# description is shortened
full_description = self._call_api(
host, video_id, 'description', note='Downloading description JSON',
fatal=False)

description = None
if isinstance(full_description, dict):
description = str_or_none(full_description.get('description'))
if not description:
description = video.get('description')
if isinstance(full_description, dict):
description = str_or_none(full_description.get('description')) or description

subtitles = self.extract_subtitles(host, video_id)

Expand Down

0 comments on commit a803582

Please sign in to comment.