aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbopol <bopol@e.email>2021-07-01 08:53:22 +0200
committerGitHub <noreply@github.com>2021-07-01 06:53:22 +0000
commita8035827177d6b59aca03bd717acb6a9bdd75ada (patch)
tree150bc24c1b325e5f36da7adca8f0f3f6068530fa
parent7fb9564420d43252c8f8c453d4dc54bf3ff9f8ee (diff)
[peertube] only call description endpoint if necessary (#29383)
-rw-r--r--youtube_dl/extractor/peertube.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/youtube_dl/extractor/peertube.py b/youtube_dl/extractor/peertube.py
index d9b13adc2..3af533925 100644
--- a/youtube_dl/extractor/peertube.py
+++ b/youtube_dl/extractor/peertube.py
@@ -569,15 +569,15 @@ class PeerTubeIE(InfoExtractor):
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)