3 from .common
import InfoExtractor
4 from ..utils
import parse_duration
, remove_end
, unified_strdate
, urljoin
7 class NDTVIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://(?:[^/]+\.)?ndtv\.com/(?:[^/]+/)*videos?/?(?:[^/]+/)*[^/?^&]+-(?P<id>\d+)'
13 'url': 'https://khabar.ndtv.com/video/show/prime-time/prime-time-ill-system-and-poor-education-468818',
14 'md5': '78efcf3880ef3fd9b83d405ca94a38eb',
18 'title': 'प्राइम टाइम: सिस्टम बीमार, स्कूल बदहाल',
19 'description': 'md5:f410512f1b49672e5695dea16ef2731d',
20 'upload_date': '20170928',
22 'thumbnail': r
're:https?://.*\.jpg',
27 'url': 'http://movies.ndtv.com/videos/cracker-free-diwali-wishes-from-karan-johar-kriti-sanon-other-stars-470304',
28 'md5': 'f1d709352305b44443515ac56b45aa46',
32 'title': 'Cracker-Free Diwali Wishes From Karan Johar, Kriti Sanon & Other Stars',
33 'description': 'md5:f115bba1adf2f6433fa7c1ade5feb465',
34 'upload_date': '20171019',
36 'thumbnail': r
're:https?://.*\.jpg',
40 'url': 'https://www.ndtv.com/video/news/news/delhi-s-air-quality-status-report-after-diwali-is-very-poor-470372',
41 'only_matching': True,
44 'url': 'https://auto.ndtv.com/videos/the-cnb-daily-october-13-2017-469935',
45 'only_matching': True,
48 'url': 'https://sports.ndtv.com/cricket/videos/2nd-t20i-rock-thrown-at-australia-cricket-team-bus-after-win-over-india-469764',
49 'only_matching': True,
52 'url': 'http://gadgets.ndtv.com/videos/uncharted-the-lost-legacy-review-465568',
53 'only_matching': True,
56 'url': 'http://profit.ndtv.com/videos/news/video-indian-economy-on-very-solid-track-international-monetary-fund-chief-470040',
57 'only_matching': True,
60 'url': 'http://food.ndtv.com/video-basil-seeds-coconut-porridge-419083',
61 'only_matching': True,
64 'url': 'https://doctor.ndtv.com/videos/top-health-stories-of-the-week-467396',
65 'only_matching': True,
68 'url': 'https://swirlster.ndtv.com/video/how-to-make-friends-at-work-469324',
69 'only_matching': True,
73 def _real_extract(self
, url
):
74 video_id
= self
._match
_id
(url
)
75 webpage
= self
._download
_webpage
(url
, video_id
)
77 # '__title' does not contain extra words such as sub-site name, "Video" etc.
78 title
= urllib
.parse
.unquote_plus(
79 self
._search
_regex
(r
"__title\s*=\s*'([^']+)'", webpage
, 'title', default
=None)
80 or self
._og
_search
_title
(webpage
))
82 filename
= self
._search
_regex
(
83 r
"(?:__)?filename\s*[:=]\s*'([^']+)'", webpage
, 'video filename')
84 # in "movies" sub-site pages, filename is URL
85 video_url
= urljoin('https://ndtvod.bc-ssl.cdn.bitgravity.com/23372/ndtv/', filename
.lstrip('/'))
87 # "doctor" sub-site has MM:SS format
88 duration
= parse_duration(self
._search
_regex
(
89 r
"(?:__)?duration\s*[:=]\s*'([^']+)'", webpage
, 'duration', fatal
=False))
91 # "sports", "doctor", "swirlster" sub-sites don't have 'publish-date'
92 upload_date
= unified_strdate(self
._html
_search
_meta
(
93 'publish-date', webpage
, 'upload date', default
=None) or self
._html
_search
_meta
(
94 'uploadDate', webpage
, 'upload date', default
=None) or self
._search
_regex
(
95 r
'datePublished"\s*:\s*"([^"]+)"', webpage
, 'upload date', fatal
=False))
97 description
= remove_end(self
._og
_search
_description
(webpage
), ' (Read more)')
103 'description': description
,
104 'thumbnail': self
._og
_search
_thumbnail
(webpage
),
105 'duration': duration
,
106 'upload_date': upload_date
,