]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/soulanime.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
12 class SoulAnimeWatchingIE(InfoExtractor
):
13 IE_NAME
= "soulanime:watching"
14 IE_DESC
= "SoulAnime video"
16 'url': 'http://www.soul-anime.net/watching/seirei-tsukai-no-blade-dance-episode-9/',
17 'md5': '05fae04abf72298098b528e98abf4298',
19 'id': 'seirei-tsukai-no-blade-dance-episode-9',
21 'title': 'seirei-tsukai-no-blade-dance-episode-9',
22 'description': 'seirei-tsukai-no-blade-dance-episode-9'
25 _VALID_URL
= r
'http://[w.]*soul-anime\.(?P<domain>[^/]+)/watch[^/]*/(?P<id>[^/]+)'
27 def _real_extract(self
, url
):
28 mobj
= re
.match(self
._VALID
_URL
, url
)
29 video_id
= mobj
.group('id')
30 domain
= mobj
.group('domain')
32 page
= self
._download
_webpage
(url
, video_id
)
34 video_url_encoded
= self
._html
_search
_regex
(
35 r
'<div id="download">[^<]*<a href="(?P<url>[^"]+)"', page
, 'url')
36 video_url
= "http://www.soul-anime." + domain
+ video_url_encoded
38 ext_req
= HEADRequest(video_url
)
39 ext_handle
= self
._request
_webpage
(
40 ext_req
, video_id
, note
='Determining extension')
41 ext
= urlhandle_detect_ext(ext_handle
)
48 'description': video_id
52 class SoulAnimeSeriesIE(InfoExtractor
):
53 IE_NAME
= "soulanime:series"
54 IE_DESC
= "SoulAnime Series"
56 _VALID_URL
= r
'http://[w.]*soul-anime\.(?P<domain>[^/]+)/anime./(?P<id>[^/]+)'
58 _EPISODE_REGEX
= r
'<option value="(/watch[^/]*/[^"]+)">[^<]*</option>'
61 'url': 'http://www.soul-anime.net/anime1/black-rock-shooter-tv/',
63 'id': 'black-rock-shooter-tv'
68 def _real_extract(self
, url
):
69 mobj
= re
.match(self
._VALID
_URL
, url
)
70 series_id
= mobj
.group('id')
71 domain
= mobj
.group('domain')
73 pattern
= re
.compile(self
._EPISODE
_REGEX
)
75 page
= self
._download
_webpage
(url
, series_id
, "Downloading series page")
76 mobj
= pattern
.findall(page
)
78 entries
= [self
.url_result("http://www.soul-anime." + domain
+ obj
) for obj
in mobj
]
80 return self
.playlist_result(entries
, series_id
)