[animeondemand] Improve extraction

This commit is contained in:
Sergey M․ 2016-03-18 00:02:34 +06:00
parent b57fecfddd
commit 85e8f26b82

View File

@ -30,6 +30,10 @@ class AnimeOnDemandIE(InfoExtractor):
# Film wording is used instead of Episode # Film wording is used instead of Episode
'url': 'https://www.anime-on-demand.de/anime/39', 'url': 'https://www.anime-on-demand.de/anime/39',
'only_matching': True, 'only_matching': True,
}, {
# Episodes without titles
'url': 'https://www.anime-on-demand.de/anime/162',
'only_matching': True,
}] }]
def _login(self): def _login(self):
@ -95,14 +99,22 @@ class AnimeOnDemandIE(InfoExtractor):
entries = [] entries = []
for episode_html in re.findall(r'(?s)<h3[^>]+class="episodebox-title".+?>Episodeninhalt<', webpage): for num, episode_html in enumerate(re.findall(
m = re.search( r'(?s)<h3[^>]+class="episodebox-title".+?>Episodeninhalt<', webpage)):
r'class="episodebox-title"[^>]+title="(?:Episode|Film)\s*(?P<number>\d+)\s*-\s*(?P<title>.+?)"', episode_html) episodebox_title = self._search_regex(
if not m: (r'class="episodebox-title"[^>]+title="(.+?)"',
r'class="episodebox-title"[^>]+>(.+?)<'),
webpage, 'episodebox title', default=None)
if not episodebox_title:
continue continue
episode_number = int(m.group('number')) episode_number = int(self._search_regex(
episode_title = m.group('title') 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 video_id = 'episode-%d' % episode_number
common_info = { common_info = {