Skip to content

Commit

Permalink
[lecturio] Improve subtitles extraction (closes #18488)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw authored and haraldmartin committed Dec 12, 2018
1 parent 9ccaa9e commit dc69b3b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions youtube_dl/extractor/lecturio.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,15 @@ def _real_extract(self, url):
cc_url = url_or_none(cc_url)
if not cc_url:
continue
sub_dict = automatic_captions if 'auto-translated' in cc_label else subtitles
lang = self._search_regex(
r'/([a-z]{2})_', cc_url, 'lang', default=cc_label.split()[0])
r'/([a-z]{2})_', cc_url, 'lang',
default=cc_label.split()[0] if cc_label else 'en')
original_lang = self._search_regex(
r'/[a-z]{2}_([a-z]{2})_', cc_url, 'original lang',
default=None)
sub_dict = (automatic_captions
if 'auto-translated' in cc_label or original_lang
else subtitles)
sub_dict.setdefault(self._CC_LANGS.get(lang, lang), []).append({
'url': cc_url,
})
Expand Down

0 comments on commit dc69b3b

Please sign in to comment.