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.

56 lines
2.0 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import re
  4. from .common import InfoExtractor
  5. class DBTVIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?dbtv\.no/(?:[^/]+/)?(?P<id>[0-9]+)(?:#(?P<display_id>.+))?'
  7. _TESTS = [{
  8. 'url': 'http://dbtv.no/3649835190001#Skulle_teste_ut_fornøyelsespark,_men_kollegaen_var_bare_opptatt_av_bikinikroppen',
  9. 'md5': '2e24f67936517b143a234b4cadf792ec',
  10. 'info_dict': {
  11. 'id': '3649835190001',
  12. 'display_id': 'Skulle_teste_ut_fornøyelsespark,_men_kollegaen_var_bare_opptatt_av_bikinikroppen',
  13. 'ext': 'mp4',
  14. 'title': 'Skulle teste ut fornøyelsespark, men kollegaen var bare opptatt av bikinikroppen',
  15. 'description': 'md5:1504a54606c4dde3e4e61fc97aa857e0',
  16. 'thumbnail': r're:https?://.*\.jpg',
  17. 'timestamp': 1404039863,
  18. 'upload_date': '20140629',
  19. 'duration': 69.544,
  20. 'uploader_id': '1027729757001',
  21. },
  22. 'add_ie': ['BrightcoveNew']
  23. }, {
  24. 'url': 'http://dbtv.no/3649835190001',
  25. 'only_matching': True,
  26. }, {
  27. 'url': 'http://www.dbtv.no/lazyplayer/4631135248001',
  28. 'only_matching': True,
  29. }, {
  30. 'url': 'http://dbtv.no/vice/5000634109001',
  31. 'only_matching': True,
  32. }, {
  33. 'url': 'http://dbtv.no/filmtrailer/3359293614001',
  34. 'only_matching': True,
  35. }]
  36. @staticmethod
  37. def _extract_urls(webpage):
  38. return [url for _, url in re.findall(
  39. r'<iframe[^>]+src=(["\'])((?:https?:)?//(?:www\.)?dbtv\.no/(?:lazy)?player/\d+.*?)\1',
  40. webpage)]
  41. def _real_extract(self, url):
  42. video_id, display_id = re.match(self._VALID_URL, url).groups()
  43. return {
  44. '_type': 'url_transparent',
  45. 'url': 'http://players.brightcove.net/1027729757001/default_default/index.html?videoId=%s' % video_id,
  46. 'id': video_id,
  47. 'display_id': display_id,
  48. 'ie_key': 'BrightcoveNew',
  49. }