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.

53 lines
1.8 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. import json
  5. from .common import InfoExtractor
  6. from ..utils import compat_urllib_parse
  7. class YnetIE(InfoExtractor):
  8. _VALID_URL = r'http://(?:.+?\.)?ynet\.co\.il/(?:.+?/)?0,7340,(?P<id>L(?:-[0-9]+)+),00\.html'
  9. _TESTS = [
  10. {
  11. 'url': 'http://hot.ynet.co.il/home/0,7340,L-11659-99244,00.html',
  12. 'md5': '002b44ee2f33d50363a1c153bed524cf',
  13. 'info_dict': {
  14. 'id': 'L-11659-99244',
  15. 'ext': 'flv',
  16. 'title': 'איש לא יודע מאיפה באנו',
  17. 'thumbnail': 're:^https?://.*\.jpg',
  18. }
  19. }, {
  20. 'url': 'http://hot.ynet.co.il/home/0,7340,L-8859-84418,00.html',
  21. 'md5': '6455046ae1b48cf7e2b7cae285e53a16',
  22. 'info_dict': {
  23. 'id': 'L-8859-84418',
  24. 'ext': 'flv',
  25. 'title': "צפו: הנשיקה הלוהטת של תורגי' ויוליה פלוטקין",
  26. 'thumbnail': 're:^https?://.*\.jpg',
  27. }
  28. }
  29. ]
  30. def _real_extract(self, url):
  31. mobj = re.match(self._VALID_URL, url)
  32. video_id = mobj.group('id')
  33. webpage = self._download_webpage(url, video_id)
  34. content = compat_urllib_parse.unquote_plus(self._og_search_video_url(webpage))
  35. config = json.loads(self._search_regex(r'config=({.+?})$', content, 'video config'))
  36. f4m_url = config['clip']['url']
  37. title = self._og_search_title(webpage)
  38. m = re.search(r'ynet - HOT -- (["\']+)(?P<title>.+?)\1', title)
  39. if m:
  40. title = m.group('title')
  41. return {
  42. 'id': video_id,
  43. 'title': title,
  44. 'formats': self._extract_f4m_formats(f4m_url, video_id),
  45. 'thumbnail': self._og_search_thumbnail(webpage),
  46. }