diff options
author | Sergey M․ <dstftw@gmail.com> | 2016-03-18 00:02:34 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2016-03-18 00:02:34 +0600 |
commit | 85e8f26b827e77cbed6a83268787d450ab2bea3b (patch) | |
tree | f95ea7f64b86356081eee04df417f0f087e487c4 /youtube_dl/extractor/animeondemand.py | |
parent | b57fecfdddc78b5ef5cfd1c3302f7b79ab1bf64f (diff) |
[animeondemand] Improve extraction
Diffstat (limited to 'youtube_dl/extractor/animeondemand.py')
-rw-r--r-- | youtube_dl/extractor/animeondemand.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/youtube_dl/extractor/animeondemand.py b/youtube_dl/extractor/animeondemand.py index 6cb3a84f9..3631c2451 100644 --- a/youtube_dl/extractor/animeondemand.py +++ b/youtube_dl/extractor/animeondemand.py @@ -30,6 +30,10 @@ class AnimeOnDemandIE(InfoExtractor): # Film wording is used instead of Episode 'url': 'https://www.anime-on-demand.de/anime/39', 'only_matching': True, + }, { + # Episodes without titles + 'url': 'https://www.anime-on-demand.de/anime/162', + 'only_matching': True, }] def _login(self): @@ -95,14 +99,22 @@ class AnimeOnDemandIE(InfoExtractor): entries = [] - for episode_html in re.findall(r'(?s)<h3[^>]+class="episodebox-title".+?>Episodeninhalt<', webpage): - m = re.search( - r'class="episodebox-title"[^>]+title="(?:Episode|Film)\s*(?P<number>\d+)\s*-\s*(?P<title>.+?)"', episode_html) - if not m: + for num, episode_html in enumerate(re.findall( + r'(?s)<h3[^>]+class="episodebox-title".+?>Episodeninhalt<', webpage)): + episodebox_title = self._search_regex( + (r'class="episodebox-title"[^>]+title="(.+?)"', + r'class="episodebox-title"[^>]+>(.+?)<'), + webpage, 'episodebox title', default=None) + if not episodebox_title: continue - episode_number = int(m.group('number')) - episode_title = m.group('title') + episode_number = int(self._search_regex( + r'^(?:Episode|Film)\s*(\d+)', + episodebox_title, 'episode number', default=num)) + episode_title = self._search_regex( + r'(?:Episode|Film)\s*\d+\s*-\s*(?P<title>.+?)', + episodebox_title, 'episode title', default=None) + video_id = 'episode-%d' % episode_number common_info = { |