You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.3 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. class SoulAnimeWatchingIE(InfoExtractor):
  5. IE_NAME = "soulanime:watching"
  6. IE_DESC = "SoulAnime video"
  7. _TEST = {
  8. 'url': 'http://www.soul-anime.net/watching/seirei-tsukai-no-blade-dance-episode-9/',
  9. 'md5': '05fae04abf72298098b528e98abf4298',
  10. 'info_dict': {
  11. 'id': 'seirei-tsukai-no-blade-dance-episode-9',
  12. 'ext': 'mp4',
  13. 'title': 'seirei-tsukai-no-blade-dance-episode-9',
  14. 'description': 'seirei-tsukai-no-blade-dance-episode-9'
  15. }
  16. }
  17. _VALID_URL = r'http://[w.]*soul-anime\.(?P<domain>[^/]+)/watch[^/]*/(?P<id>[^/]+)'
  18. def _real_extract(self, url):
  19. mobj = re.match(self._VALID_URL, url)
  20. video_id = mobj.group('id')
  21. domain = mobj.group('domain')
  22. page = self._download_webpage(url, video_id)
  23. video_url_encoded = self._html_search_regex(
  24. r'<div id="download">[^<]*<a href="(?P<url>[^"]+)"', page, 'url')
  25. video_url = "http://www.soul-anime." + domain + video_url_encoded
  26. vid = self._request_webpage(video_url, video_id)
  27. ext = vid.info().gettype().split("/")[1]
  28. return {
  29. 'id': video_id,
  30. 'url': video_url,
  31. 'ext': ext,
  32. 'title': video_id,
  33. 'description': video_id
  34. }
  35. class SoulAnimeSeriesIE(InfoExtractor):
  36. IE_NAME = "soulanime:series"
  37. IE_DESC = "SoulAnime Series"
  38. _VALID_URL = r'http://[w.]*soul-anime\.(?P<domain>[^/]+)/anime./(?P<id>[^/]+)'
  39. _EPISODE_REGEX = r'<option value="(/watch[^/]*/[^"]+)">[^<]*</option>'
  40. _TEST = {
  41. 'url': 'http://www.soul-anime.net/anime1/black-rock-shooter-tv/',
  42. 'info_dict': {
  43. 'id': 'black-rock-shooter-tv'
  44. },
  45. 'playlist_count': 8
  46. }
  47. def _real_extract(self, url):
  48. mobj = re.match(self._VALID_URL, url)
  49. series_id = mobj.group('id')
  50. domain = mobj.group('domain')
  51. pattern = re.compile(self._EPISODE_REGEX)
  52. page = self._download_webpage(url, series_id, "Downloading series page")
  53. mobj = pattern.findall(page)
  54. entries = [self.url_result("http://www.soul-anime." + domain + obj) for obj in mobj]
  55. return self.playlist_result(entries, series_id)