-from __future__ import unicode_literals
-
import json
-import re
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 = {}
def _fetch_token(self, site, url):
if self._TOKENS.get(site):
return
- email, password = self._get_login_info(netrc_machine=site)
- if email:
- self.report_warning('Logging in using username and password is broken. %s' % self._LOGIN_HINTS['cookies'])
cookies = self._get_cookies(url)
if cookies and cookies.get('token'):
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]
_TESTS = [{
'url': 'http://embed.snagfilms.com/embed/player?filmId=74849a00-85a9-11e1-9660-123139220831&w=500',
'md5': '2924e9215c6eff7a55ed35b72276bd93',
'only_matching': True,
}]
- @staticmethod
- def _extract_url(webpage):
- mobj = re.search(
- r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:embed\.)?(?:%s)/embed/player.+?)\1' % ViewLiftBaseIE._DOMAINS_REGEX,
- webpage)
- if mobj:
- return mobj.group('url')
-
def _real_extract(self, url):
domain, film_id = self._match_valid_url(url).groups()
site = domain.split('.')[-2]
'url': sub_url,
})
- self._sort_formats(formats)
return {
'id': film_id,
'title': title,
'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
}, { # Premium movie
'url': 'https://www.hoichoi.tv/movies/detective-2020',
'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