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.

51 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': '4b29cb57c3dddd57642b3f051f535b07',
  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': '8194c2ea221e9a639cac96b6b0753dc5',
  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. video_id = self._match_id(url)
  32. webpage = self._download_webpage(url, video_id)
  33. content = compat_urllib_parse.unquote_plus(self._og_search_video_url(webpage))
  34. config = json.loads(self._search_regex(r'config=({.+?})$', content, 'video config'))
  35. f4m_url = config['clip']['url']
  36. title = self._og_search_title(webpage)
  37. m = re.search(r'ynet - HOT -- (["\']+)(?P<title>.+?)\1', title)
  38. if m:
  39. title = m.group('title')
  40. return {
  41. 'id': video_id,
  42. 'title': title,
  43. 'formats': self._extract_f4m_formats(f4m_url, video_id),
  44. 'thumbnail': self._og_search_thumbnail(webpage),
  45. }