1 from __future__ import unicode_literals
5 from .common import InfoExtractor
9 get_element_by_attribute,
14 class GoGoAnimeIE(InfoExtractor):
17 _VALID_URL = r'http://www.gogoanime.com/(?P<id>[A-Za-z0-9-]+)'
20 'url': 'http://www.gogoanime.com/mahou-shoujo-madoka-magica-movie-1',
22 'id': 'mahou-shoujo-madoka-magica-movie-1'
27 def _real_extract(self, url):
28 video_id = self._match_id(url)
29 page = self._download_webpage(url, video_id)
31 if 'Oops! Page Not Found</font>' in page:
32 raise ExtractorError('Video does not exist', expected=True)
34 content = get_element_by_attribute("class", "postcontent", page)
35 vids = re.findall(r'<iframe[^>]*?src=[\'"](h[^\'"]+)[\'"]', content)
37 unescapeHTML(compat_urllib_parse.unquote(x))
38 for x in vids if not re.search(r".*videofun.*", x)]
40 if re.search(r'<div class="postcontent">[^<]*<p><iframe src=[\'"][^>]+></iframe><br />', page):
41 return self.playlist_result([self.url_result(vid) for vid in vids], video_id)
43 title = self._html_search_regex(
44 r'<div class="postdesc">[^<]*<h1>([^<]+)</h1>', page, 'title')
54 class GoGoAnimeSearchIE(InfoExtractor):
55 IE_NAME = 'gogoanime:search'
56 IE_DESC = 'GoGoAnime Search'
58 _VALID_URL = r'http://www\.gogoanime\.com/.*\?s=(?P<id>[^&]*)'
60 'url': 'http://www.gogoanime.com/?s=bokusatsu',
67 def _real_extract(self, url):
68 playlist_id = self._match_id(url)
69 webpage = self._download_webpage(url, playlist_id)
72 r'<div class="postlist">[^<]*<p[^>]*>[^<]*<a href="(?P<url>[^"]+)"',
75 return self.playlist_result(
76 [self.url_result(p) for p in posts], playlist_id)