import json
from .common import InfoExtractor
-from ..compat import compat_HTTPError
+from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
int_or_none,
class ViewLiftBaseIE(InfoExtractor):
_API_BASE = 'https://prod-api.viewlift.com/'
- _DOMAINS_REGEX = r'(?:(?:main\.)?snagfilms|snagxtreme|funnyforfree|kiddovid|winnersview|(?:monumental|lax)sportsnetwork|vayafilm|failarmy|ftfnext|lnppass\.legapallacanestro|moviespree|app\.myoutdoortv|neoufitness|pflmma|theidentitytb)\.com|(?:hoichoi|app\.horseandcountry|kronon|marquee|supercrosslive)\.tv'
+ _DOMAINS_REGEX = r'(?:(?:main\.)?snagfilms|snagxtreme|funnyforfree|kiddovid|winnersview|(?:monumental|lax)sportsnetwork|vayafilm|failarmy|ftfnext|lnppass\.legapallacanestro|moviespree|app\.myoutdoortv|neoufitness|pflmma|theidentitytb|chorki)\.com|(?:hoichoi|app\.horseandcountry|kronon|marquee|supercrosslive)\.tv'
_SITE_MAP = {
'ftfnext': 'lax',
'funnyforfree': 'snagfilms',
'snagxtreme': 'snagfilms',
'theidentitytb': 'tampabay',
'vayafilm': 'snagfilms',
+ 'chorki': 'prothomalo',
}
_TOKENS = {}
return self._download_json(
self._API_BASE + path, video_id, headers={'Authorization': self._TOKENS.get(site)}, query=query)
except ExtractorError as e:
- if isinstance(e.cause, compat_HTTPError) and e.cause.code == 403:
- webpage = e.cause.read().decode()
+ if isinstance(e.cause, HTTPError) and e.cause.status == 403:
+ webpage = e.cause.response.read().decode()
try:
error_message = traverse_obj(json.loads(webpage), 'errorMessage', 'message')
except json.JSONDecodeError:
class ViewLiftEmbedIE(ViewLiftBaseIE):
IE_NAME = 'viewlift:embed'
- _VALID_URL = r'https?://(?:(?:www|embed)\.)?(?P<domain>%s)/embed/player\?.*\bfilmId=(?P<id>[\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12})' % ViewLiftBaseIE._DOMAINS_REGEX
- _EMBED_REGEX = [r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:embed\.)?(?:%s)/embed/player.+?)\1' % ViewLiftBaseIE._DOMAINS_REGEX]
+ _VALID_URL = rf'https?://(?:(?:www|embed)\.)?(?P<domain>{ViewLiftBaseIE._DOMAINS_REGEX})/embed/player\?.*\bfilmId=(?P<id>[\da-f]{{8}}-(?:[\da-f]{{4}}-){{3}}[\da-f]{{12}})'
+ _EMBED_REGEX = [rf'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:embed\.)?(?:{ViewLiftBaseIE._DOMAINS_REGEX})/embed/player.+?)\1']
_TESTS = [{
'url': 'http://embed.snagfilms.com/embed/player?filmId=74849a00-85a9-11e1-9660-123139220831&w=500',
'md5': '2924e9215c6eff7a55ed35b72276bd93',
'description': 'md5:b542bef32a6f657dadd0df06e26fb0c8',
'timestamp': 1334350096,
'upload_date': '20120413',
- }
+ },
}, {
# invalid labels, 360p is better that 480p
'url': 'http://www.snagfilms.com/embed/player?filmId=17ca0950-a74a-11e0-a92a-0026bb61d036',
content_data = self._call_api(
site, 'entitlement/video/status', film_id, url, {
- 'id': film_id
+ 'id': film_id,
})['video']
gist = content_data['gist']
title = gist['title']
'height', default=None))
formats.append({
'url': video_asset_url,
- 'format_id': 'http%s' % ('-%d' % bitrate if bitrate else ''),
+ 'format_id': 'http{}'.format(f'-{bitrate}' if bitrate else ''),
'tbr': bitrate,
'height': height,
'vcodec': video_asset.get('codec'),
'url': sub_url,
})
- self._sort_formats(formats)
return {
'id': film_id,
'title': title,
class ViewLiftIE(ViewLiftBaseIE):
IE_NAME = 'viewlift'
_API_BASE = 'https://prod-api-cached-2.viewlift.com/'
- _VALID_URL = r'https?://(?:www\.)?(?P<domain>%s)(?P<path>(?:/(?:films/title|show|(?:news/)?videos?|watch))?/(?P<id>[^?#]+))' % ViewLiftBaseIE._DOMAINS_REGEX
+ _VALID_URL = rf'https?://(?:www\.)?(?P<domain>{ViewLiftBaseIE._DOMAINS_REGEX})(?P<path>(?:/(?:films/title|show|(?:news/)?videos?|watch))?/(?P<id>[^?#]+))'
_TESTS = [{
'url': 'http://www.snagfilms.com/films/title/lost_for_life',
'md5': '19844f897b35af219773fd63bdec2942',
'age_limit': 14,
'upload_date': '20150421',
'timestamp': 1429656820,
- }
+ },
}, {
'url': 'http://www.snagfilms.com/show/the_world_cut_project/india',
'md5': 'e6292e5b837642bbda82d7f8bf3fbdfd',
'duration': 979,
'timestamp': 1399478279,
'upload_date': '20140507',
- }
+ },
}, {
'url': 'http://main.snagfilms.com/augie_alone/s_2_ep_12_love',
'info_dict': {
'description': 'md5:e28f2fb8680096a69c944d37c1fa5ffc',
'thumbnail': r're:^https?://.*\.jpg$',
'upload_date': '20211006',
- 'series': None
},
'params': {'skip_download': True},
}, { # Free film
'description': 'md5:605cba408e51a79dafcb824bdeded51e',
'thumbnail': r're:^https?://.*\.jpg$',
'upload_date': '20210827',
- 'series': None
},
'params': {'skip_download': True},
}, { # Free episode
'description': 'md5:ca30a682b4528d02a3eb6d0427dd0f87',
'thumbnail': r're:^https?://.*\.jpg$',
'upload_date': '20210830',
- 'series': 'Case Jaundice'
+ 'series': 'Case Jaundice',
},
'params': {'skip_download': True},
}, { # Free video
'description': 'md5:9d21edc1827d32f8633eb67c2054fc31',
'thumbnail': r're:^https?://.*\.jpg$',
'upload_date': '20211006',
- 'series': 'Six (Hindi)'
+ 'series': 'Six (Hindi)',
},
'params': {'skip_download': True},
}, { # Free episode
'description': 'md5:ef6ffae01a3d83438597367400f824ed',
'thumbnail': r're:^https?://.*\.jpg$',
'upload_date': '20211004',
- 'series': 'Asian Paints Moner Thikana'
+ 'series': 'Asian Paints Moner Thikana',
},
'params': {'skip_download': True},
}, { # Free series
},
}, { # Premium movie
'url': 'https://www.hoichoi.tv/movies/detective-2020',
- 'only_matching': True
+ 'only_matching': True,
+ }, { # Chorki Premium series
+ 'url': 'https://www.chorki.com/bn/series/sinpaat',
+ 'playlist_mincount': 7,
+ 'info_dict': {
+ 'id': 'bn/series/sinpaat',
+ },
+ }, { # Chorki free movie
+ 'url': 'https://www.chorki.com/bn/videos/bangla-movie-bikkhov',
+ 'info_dict': {
+ 'id': '564e755b-f5c7-4515-aee6-8959bee18c93',
+ 'title': 'Bikkhov',
+ 'ext': 'mp4',
+ 'upload_date': '20230824',
+ 'timestamp': 1692860553,
+ 'categories': ['Action Movies', 'Salman Special'],
+ 'tags': 'count:14',
+ 'thumbnail': 'https://snagfilms-a.akamaihd.net/dd078ff5-b16e-45e4-9723-501b56b9df0a/images/2023/08/24/1692860450729_1920x1080_16x9Images.jpg',
+ 'display_id': 'bn/videos/bangla-movie-bikkhov',
+ 'description': 'md5:71492b086450625f4374a3eb824f27dc',
+ 'duration': 8002,
+ },
+ 'params': {
+ 'skip_download': True,
+ },
+ }, { # Chorki Premium movie
+ 'url': 'https://www.chorki.com/bn/videos/something-like-an-autobiography',
+ 'only_matching': True,
}]
@classmethod
def suitable(cls, url):
- return False if ViewLiftEmbedIE.suitable(url) else super(ViewLiftIE, cls).suitable(url)
+ return False if ViewLiftEmbedIE.suitable(url) else super().suitable(url)
def _show_entries(self, domain, seasons):
for season in seasons:
film_id = next(m['contentData'][0]['gist']['id'] for m in modules if m.get('moduleType') == 'VideoDetailModule')
return {
'_type': 'url_transparent',
- 'url': 'http://%s/embed/player?filmId=%s' % (domain, film_id),
+ 'url': f'http://{domain}/embed/player?filmId={film_id}',
'id': film_id,
'display_id': display_id,
'ie_key': 'ViewLiftEmbed',