diff --git a/youtube_dl/extractor/xmovies8.py b/youtube_dl/extractor/xmovies8.py index e27dafa79..6a8decc88 100644 --- a/youtube_dl/extractor/xmovies8.py +++ b/youtube_dl/extractor/xmovies8.py @@ -17,6 +17,12 @@ from ..utils import ( sanitized_Request, update_Request ) +def urljoin(*args): + """ + Joins given arguments into a url. Trailing but not leading slashes are + stripped for each argument. + """ + return "/".join(map(lambda x: str(x).rstrip('/'), args)) def cookie_to_dict(cookie): cookie_dict = { 'name': cookie.name, @@ -87,14 +93,34 @@ class XMovies8IE(InfoExtractor): # 'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)', 'md5': 'f72c89fe7ecc14c1b5ce506c4996046e', 'info_dict': { - 'id': '36164052', - 'ext': 'flv', - 'title': '데일리 에이프릴 요정들의 시상식!', - 'thumbnail': 're:^https?://(?:video|st)img.afreecatv.com/.*$', - 'uploader': 'dailyapril', - 'uploader_id': 'dailyapril', - 'upload_date': '20160503', + 'id': '24749', + 'title': "The Hitman's Bodyguard (2017)", + 'ext': 'mp4', + 'description': "The world's top bodyguard gets a new client, a hit man who must testify at the International Court of Justice. They must put their differences aside and work together to make it to the trial on time.", + 'thumbnail': 'https://img.xmovies88.stream/crop/215/310/media/imagesv2/2017/08/the-hitman-s-bodyguard-2017-poster.jpg', + 'formats': [{ + 'format_id': '1287', + 'url': 'https://s4.ostr.tv/hls/qvsbfwjmnxblgwsztrb2a5mblc3lpikarb6xmlv774kcxkug6nhunwo5q6pa/index-v1-a1.m3u8', + 'manifest_url': 'https://s4.ostr.tv/hls/,qvsbfwjmnxblgwsztrb2a5mblc3lpikarb6xmlv774kcxkug6nhunwo5q6pa,.urlset/master.m3u8', + 'tbr': 1287.551, + 'ext': 'mp4', + 'fps': 23.974, + 'protocol': 'm3u8', + 'preference': None, + 'width': 1280, + 'height': 720, + 'vcodec': 'avc1.64001f', + 'acodec': 'mp4a.40.2'}] }, + # 'info_dict': { + # 'id': '36164052', + # 'ext': 'flv', + # 'title': '데일리 에이프릴 요정들의 시상식!', + # 'thumbnail': 're:^https?://(?:video|st)img.afreecatv.com/.*$', + # 'uploader': 'dailyapril', + # 'uploader_id': 'dailyapril', + # 'upload_date': '20160503', + # }, 'params': { # m3u8 download 'skip_download': True, @@ -234,24 +260,79 @@ class XMovies8IE(InfoExtractor): video_id = mobj.group('id') isWatching = mobj.group('isWatching') - - full_video_url = compat_urlparse.urljoin(url, "/watching.html") if not isWatching else url - parsed_url = compat_urllib_parse_urlparse(full_video_url) + print("original :", url) + # url = compat_urlparse.urljoin(url, "/watching") if not isWatching else url + base_url = compat_urlparse.urljoin(url,"/") + print("base :", base_url) + parsed_url = compat_urllib_parse_urlparse(url) + print("after parsed:", parsed_url) headers = { 'User-Agent': self._USER_AGENT, # 'Cookie':'__cfduid='+cfduid, 'Referer':'http://'+parsed_url.netloc+'/', # 'Host':parsed_url.netloc } - req = sanitized_Request(full_video_url) + req = sanitized_Request(base_url) self._solve_challenge(req,headers) try: - webpage = self._download_webpage(req, video_id, headers=headers) - print("??????") + + path = urljoin(parsed_url.path,"watching.html") if not isWatching else parsed_url.path + #print(path) + print(compat_urlparse.urljoin(base_url,path)) + webpage = self._download_webpage(compat_urlparse.urljoin(base_url,path), video_id, headers=headers) + # self.to_screen(webpage) + # title = self._html_search_regex(r'