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.

65 lines
2.2 KiB

11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
10 years ago
11 years ago
11 years ago
11 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. js_to_json,
  6. smuggle_url,
  7. )
  8. class LA7IE(InfoExtractor):
  9. IE_NAME = 'la7.it'
  10. _VALID_URL = r'''(?x)(https?://)?(?:
  11. (?:www\.)?la7\.it/([^/]+)/(?:rivedila7|video)/|
  12. tg\.la7\.it/repliche-tgla7\?id=
  13. )(?P<id>.+)'''
  14. _TESTS = [{
  15. # 'src' is a plain URL
  16. 'url': 'http://www.la7.it/crozza/video/inccool8-02-10-2015-163722',
  17. 'md5': '8b613ffc0c4bf9b9e377169fc19c214c',
  18. 'info_dict': {
  19. 'id': 'inccool8-02-10-2015-163722',
  20. 'ext': 'mp4',
  21. 'title': 'Inc.Cool8',
  22. 'description': 'Benvenuti nell\'incredibile mondo della INC. COOL. 8. dove “INC.” sta per “Incorporated” “COOL” sta per “fashion” ed Eight sta per il gesto atletico',
  23. 'thumbnail': 're:^https?://.*',
  24. 'uploader_id': 'kdla7pillole@iltrovatore.it',
  25. 'timestamp': 1443814869,
  26. 'upload_date': '20151002',
  27. },
  28. }, {
  29. # 'src' is a dictionary
  30. 'url': 'http://tg.la7.it/repliche-tgla7?id=189080',
  31. 'md5': '6b0d8888d286e39870208dfeceaf456b',
  32. 'info_dict': {
  33. 'id': '189080',
  34. 'ext': 'mp4',
  35. 'title': 'TG LA7',
  36. },
  37. }, {
  38. 'url': 'http://www.la7.it/omnibus/rivedila7/omnibus-news-02-07-2016-189077',
  39. 'only_matching': True,
  40. }]
  41. def _real_extract(self, url):
  42. video_id = self._match_id(url)
  43. webpage = self._download_webpage(url, video_id)
  44. player_data = self._parse_json(
  45. self._search_regex(r'videoLa7\(({[^;]+})\);', webpage, 'player data'),
  46. video_id, transform_source=js_to_json)
  47. return {
  48. '_type': 'url_transparent',
  49. 'url': smuggle_url('kaltura:103:%s' % player_data['vid'], {
  50. 'service_url': 'http://kdam.iltrovatore.it',
  51. }),
  52. 'id': video_id,
  53. 'title': player_data['title'],
  54. 'description': self._og_search_description(webpage, default=None),
  55. 'thumbnail': player_data.get('poster'),
  56. 'ie_key': 'Kaltura',
  57. }