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.

47 lines
1.6 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. import json
  4. from .common import InfoExtractor
  5. class ABCIE(InfoExtractor):
  6. IE_NAME = 'abc.net.au'
  7. _VALID_URL = r'http://www\.abc\.net\.au/news/[^/]+/[^/]+/(?P<id>\d+)'
  8. _TEST = {
  9. 'url': 'http://www.abc.net.au/news/2014-07-25/bringing-asylum-seekers-to-australia-would-give/5624716',
  10. 'md5': 'dad6f8ad011a70d9ddf887ce6d5d0742',
  11. 'info_dict': {
  12. 'id': '5624716',
  13. 'ext': 'mp4',
  14. 'title': 'Bringing asylum seekers to Australia would give them right to asylum claims: professor',
  15. 'description': 'md5:ba36fa5e27e5c9251fd929d339aea4af',
  16. },
  17. }
  18. def _real_extract(self, url):
  19. video_id = self._match_id(url)
  20. webpage = self._download_webpage(url, video_id)
  21. urls_info_json = self._search_regex(
  22. r'inlineVideoData\.push\((.*?)\);', webpage, 'video urls',
  23. flags=re.DOTALL)
  24. urls_info = json.loads(urls_info_json.replace('\'', '"'))
  25. formats = [{
  26. 'url': url_info['url'],
  27. 'width': int(url_info['width']),
  28. 'height': int(url_info['height']),
  29. 'tbr': int(url_info['bitrate']),
  30. 'filesize': int(url_info['filesize']),
  31. } for url_info in urls_info]
  32. self._sort_formats(formats)
  33. return {
  34. 'id': video_id,
  35. 'title': self._og_search_title(webpage),
  36. 'formats': formats,
  37. 'description': self._og_search_description(webpage),
  38. 'thumbnail': self._og_search_thumbnail(webpage),
  39. }