youtube-dl

Another place where youtube-dl lives on
git clone git://git.oshgnacknak.de/youtube-dl.git
Log | Files | Refs | README | LICENSE

commit 6cb38a999488b9a172c820b5db2cd2a5effa07c0
parent fa7df757a70b40e352735de8189f2aa7f900bc8d
Author: Philipp Hagemeister <phihag@phihag.de>
Date:   Wed,  5 Feb 2014 21:22:53 +0100

[firstpost] Add extractor (Fixes #2324)

Diffstat:
Myoutube_dl/extractor/__init__.py | 1+
Ayoutube_dl/extractor/firstpost.py | 38++++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py @@ -60,6 +60,7 @@ from .exfm import ExfmIE from .extremetube import ExtremeTubeIE from .facebook import FacebookIE from .faz import FazIE +from .firstpost import FirstpostIE from .fktv import ( FKTVIE, FKTVPosteckeIE, diff --git a/youtube_dl/extractor/firstpost.py b/youtube_dl/extractor/firstpost.py @@ -0,0 +1,38 @@ +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor + + +class FirstpostIE(InfoExtractor): + IE_NAME = 'Firstpost.com' + _VALID_URL = r'http://(?:www\.)?firstpost\.com/[^/]+/.*-(?P<id>[0-9]+)\.html' + + _TEST = { + 'url': 'http://www.firstpost.com/india/india-to-launch-indigenous-aircraft-carrier-monday-1025403.html', + 'md5': 'ee9114957692f01fb1263ed87039112a', + 'info_dict': { + 'id': '1025403', + 'ext': 'mp4', + 'title': 'India to launch indigenous aircraft carrier INS Vikrant today', + '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.', + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + + webpage = self._download_webpage(url, video_id) + video_url = self._html_search_regex( + r'<div.*?name="div_video".*?flashvars="([^"]+)">', + webpage, 'video URL') + + return { + 'id': video_id, + 'url': video_url, + 'title': self._og_search_title(webpage), + 'description': self._og_search_description(webpage), + 'thumbnail': self._og_search_thumbnail(webpage), + }