1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-26 10:24:33 +01:00

[news18] Add new extractor

This commit is contained in:
Ashwin Dhakaita 2018-11-04 09:38:58 +05:30
parent 45f72f2cd0
commit f3bffc9ec6

View File

@ -6,6 +6,15 @@ from .common import InfoExtractor
class News18IE(InfoExtractor): class News18IE(InfoExtractor):
_VALID_URL = r'''https?:\/\/www\.news18\.com[a-zA-Z0-9_\/-]+-(?P<id>\d+)\.html''' _VALID_URL = r'''https?:\/\/www\.news18\.com[a-zA-Z0-9_\/-]+-(?P<id>\d+)\.html'''
_TEST = {
'url' : 'https://www.news18.com/news/ivideos/inside-naxal-bastion-news18-visits-the-villages-voting-first-time-ever-1928149.html',
'md5' : 'cb5a78310f3e583da5ba0de38b450938',
'info_dict': {
'id': '1928149',
'ext': 'mp4',
'title': 'Inside Naxal Bastion: News18 Visits The Villages Voting First Time Ever',
}
}
def _real_extract(self, url): def _real_extract(self, url):
IE_NAME = 'News18' IE_NAME = 'News18'
@ -14,10 +23,13 @@ class News18IE(InfoExtractor):
video_url = self._search_regex(r'(?P<url>https?:\/\/vodpd\.news18\.com[\/\w_-]+\.mp4)', webpage, 'video URL',default='') video_url = self._search_regex(r'(?P<url>https?:\/\/vodpd\.news18\.com[\/\w_-]+\.mp4)', webpage, 'video URL',default='')
title = self._og_search_title(webpage) title = self._og_search_title(webpage)
print(video_url)
print(video_id)
print(title)
return { return {
'url': video_url, 'url': video_url,
'id': video_id, 'id': video_id,
'title': title, 'title': title,
'ext': '.mp4' 'ext': 'mp4'
} }