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.

38 lines
1.4 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. class FirstpostIE(InfoExtractor):
  5. IE_NAME = 'Firstpost.com'
  6. _VALID_URL = r'http://(?:www\.)?firstpost\.com/[^/]+/.*-(?P<id>[0-9]+)\.html'
  7. _TEST = {
  8. 'url': 'http://www.firstpost.com/india/india-to-launch-indigenous-aircraft-carrier-monday-1025403.html',
  9. 'md5': 'ee9114957692f01fb1263ed87039112a',
  10. 'info_dict': {
  11. 'id': '1025403',
  12. 'ext': 'mp4',
  13. 'title': 'India to launch indigenous aircraft carrier INS Vikrant today',
  14. 'description': 'Its flight deck is over twice the size of a football field, its power unit can light up the entire Kochi city and the cabling is enough to cover the distance between here to Delhi.',
  15. }
  16. }
  17. def _real_extract(self, url):
  18. mobj = re.match(self._VALID_URL, url)
  19. video_id = mobj.group('id')
  20. webpage = self._download_webpage(url, video_id)
  21. video_url = self._html_search_regex(
  22. r'<div.*?name="div_video".*?flashvars="([^"]+)">',
  23. webpage, 'video URL')
  24. return {
  25. 'id': video_id,
  26. 'url': video_url,
  27. 'title': self._og_search_title(webpage),
  28. 'description': self._og_search_description(webpage),
  29. 'thumbnail': self._og_search_thumbnail(webpage),
  30. }