2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import ExtractorError
10 class EpiconIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?epicon\.in/(?:documentaries|movies|tv-shows/[^/?#]+/[^/?#]+)/(?P<id>[^/?#]+)'
13 'url': 'https://www.epicon.in/documentaries/air-battle-of-srinagar',
15 'id': 'air-battle-of-srinagar',
17 'title': 'Air Battle of Srinagar',
18 'description': 'md5:c4de2013af9bc05ae4392e4115d518d7',
19 'thumbnail': r
're:^https?://.*\.jpg$',
22 'url': 'https://www.epicon.in/movies/krit',
27 'description': 'md5:c12b35dad915d48ccff7f013c79bab4a',
28 'thumbnail': r
're:^https?://.*\.jpg$',
31 'url': 'https://www.epicon.in/tv-shows/paapnaashini-ganga/season-1/vardaan',
35 'title': 'Paapnaashini Ganga - Season 1 - Ep 1 - VARDAAN',
36 'description': 'md5:f517058c3d0402398eefa6242f4dd6ae',
37 'thumbnail': r
're:^https?://.*\.jpg$',
40 'url': 'https://www.epicon.in/movies/jayadev',
45 'description': 'md5:09e349eecd8e585a3b6466904f19df6c',
46 'thumbnail': r
're:^https?://.*\.jpg$',
50 def _real_extract(self
, url
):
51 id = self
._match
_id
(url
)
52 webpage
= self
._download
_webpage
(url
, id)
53 cid
= self
._search
_regex
(r
'class=\"mylist-icon\ iconclick\"\ id=\"(\d+)', webpage
, 'cid')
54 headers
= {'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}
55 data
= f
'cid={cid}&action=st&type=video'.encode()
56 data_json
= self
._parse
_json
(self
._download
_json
('https://www.epicon.in/ajaxplayer/', id, headers
=headers
, data
=data
), id)
58 if not data_json
['success']:
59 raise ExtractorError(data_json
['message'], expected
=True)
61 title
= self
._search
_regex
(r
'setplaytitle=\"([^\"]+)', webpage
, 'title')
62 description
= self
._og
_search
_description
(webpage
) or None
63 thumbnail
= self
._og
_search
_thumbnail
(webpage
) or None
64 formats
= self
._extract
_m
3u8_formats
(data_json
['url']['video_url'], id)
65 self
._sort
_formats
(formats
)
68 for subtitle
in data_json
.get('subtitles', []):
69 sub_url
= subtitle
.get('file')
72 subtitles
.setdefault(subtitle
.get('lang', 'English'), []).append({
73 'url': self
._proto
_relative
_url
(sub_url
),
80 'description': description
,
81 'thumbnail': thumbnail
,
82 'subtitles': subtitles
,
86 class EpiconSeriesIE(InfoExtractor
):
87 _VALID_URL
= r
'(?!.*season)https?://(?:www\.)?epicon\.in/tv-shows/(?P<id>[^/?#]+)'
89 'url': 'https://www.epicon.in/tv-shows/1-of-something',
90 'playlist_mincount': 5,
92 'id': '1-of-something',
95 'url': 'https://www.epicon.in/tv-shows/eco-india-english',
96 'playlist_mincount': 76,
98 'id': 'eco-india-english',
101 'url': 'https://www.epicon.in/tv-shows/s/',
102 'playlist_mincount': 25,
107 'url': 'https://www.epicon.in/tv-shows/ekaant',
108 'playlist_mincount': 38,
114 def _real_extract(self
, url
):
115 id = self
._match
_id
(url
)
116 webpage
= self
._download
_webpage
(url
, id)
117 episodes
= re
.findall(r
'ct-tray-url=\"(tv-shows/%s/[^\"]+)' % id, webpage
)
118 entries
= [self
.url_result('https://www.epicon.in/%s' % episode
, ie
=EpiconIE
.ie_key()) for episode
in episodes
]
119 return self
.playlist_result(entries
, playlist_id
=id)