Fix dailymotion
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
"patterns": [
|
"patterns": [
|
||||||
{
|
{
|
||||||
"pattern": "dailymotion.com/(?:video/|swf/(?:video/|)|)(?:embed/video/|)([A-z0-9]+)",
|
"pattern": "dailymotion.com/(?:video/|swf/(?:video/|)|)(?:embed/video/|)([A-z0-9]+)",
|
||||||
"url": "http://www.dailymotion.com/embed/video/\\1"
|
"url": "https://www.dailymotion.com/player/metadata/video/\\1"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
+8
-26
@@ -1,7 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from core import httptools
|
from core import httptools
|
||||||
from core import scrapertools
|
|
||||||
from platformcode import logger, config
|
from platformcode import logger, config
|
||||||
|
|
||||||
|
|
||||||
@@ -10,7 +9,8 @@ def test_video_exists(page_url):
|
|||||||
global response
|
global response
|
||||||
|
|
||||||
response = httptools.downloadpage(page_url, cookies=False)
|
response = httptools.downloadpage(page_url, cookies=False)
|
||||||
if "Pagina non trovata" in response.data:
|
|
||||||
|
if response.json.get('error'):
|
||||||
return False, config.get_localized_string(70449) % "dailymotion"
|
return False, config.get_localized_string(70449) % "dailymotion"
|
||||||
if response.code == 404:
|
if response.code == 404:
|
||||||
return False, config.get_localized_string(70449) % "dailymotion"
|
return False, config.get_localized_string(70449) % "dailymotion"
|
||||||
@@ -18,27 +18,9 @@ def test_video_exists(page_url):
|
|||||||
|
|
||||||
|
|
||||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||||
logger.debug("(page_url='%s')" % page_url)
|
logger.info("(page_url='%s')" % page_url)
|
||||||
video_urls = []
|
data = response.json
|
||||||
cookie = {'Cookie': response.headers["set-cookie"]}
|
|
||||||
data = response.data.replace("\\", "")
|
url = data.get('qualities', {}).get('auto', [{}])[0].get('url','')
|
||||||
subtitle = scrapertools.find_single_match(data, '"subtitles":.*?"es":.*?urls":\["([^"]+)"')
|
|
||||||
qualities = scrapertools.find_multiple_matches(data, '"([^"]+)":(\[\{"type":".*?\}\])')
|
return [["m3u8 [dailymotion]", url]]
|
||||||
for calidad, urls in qualities:
|
|
||||||
patron = '"type":"(?:video|application)\\/([^"]+)","url":"([^"]+)"'
|
|
||||||
matches = scrapertools.find_multiple_matches(urls, patron)
|
|
||||||
for stream_type, stream_url in matches:
|
|
||||||
stream_type = stream_type.replace('x-mpegURL', 'm3u8')
|
|
||||||
if stream_type == "mp4":
|
|
||||||
stream_url = httptools.downloadpage(stream_url, headers=cookie, only_headers=True,
|
|
||||||
follow_redirects=False).headers.get("location", stream_url)
|
|
||||||
else:
|
|
||||||
data_m3u8 = httptools.downloadpage(stream_url).data
|
|
||||||
calidad = scrapertools.find_single_match(data_m3u8, r'NAME="([^"]+)"')
|
|
||||||
stream_url_http = scrapertools.find_single_match(data_m3u8, r'PROGRESSIVE-URI="([^"]+)"')
|
|
||||||
if stream_url_http:
|
|
||||||
stream_url = stream_url_http
|
|
||||||
video_urls.append(["%sp .%s [dailymotion]" % (calidad, stream_type), stream_url, 0, subtitle])
|
|
||||||
for video_url in video_urls:
|
|
||||||
logger.debug("%s - %s" % (video_url[0], video_url[1]))
|
|
||||||
return video_urls
|
|
||||||
Reference in New Issue
Block a user