Fix dailimotion
This commit is contained in:
@@ -41,5 +41,6 @@
|
|||||||
"type": "list",
|
"type": "list",
|
||||||
"visible": false
|
"visible": false
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"thumbnail": "server_dailymotion.png"
|
||||||
}
|
}
|
||||||
+10
-11
@@ -8,10 +8,8 @@ from platformcode import logger
|
|||||||
def test_video_exists(page_url):
|
def test_video_exists(page_url):
|
||||||
logger.info("(page_url='%s')" % page_url)
|
logger.info("(page_url='%s')" % page_url)
|
||||||
response = httptools.downloadpage(page_url)
|
response = httptools.downloadpage(page_url)
|
||||||
if "Contenido rechazado" in response.data:
|
|
||||||
return False, "[Dailymotion] El archivo no existe o ha sido borrado"
|
|
||||||
if response.code == 404:
|
if response.code == 404:
|
||||||
return False, "[Dailymotion] El archivo no existe o ha sido borrado"
|
return False, config.get_localized_string(70449) % "dailymotion"
|
||||||
return True, ""
|
return True, ""
|
||||||
|
|
||||||
|
|
||||||
@@ -21,8 +19,8 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
|||||||
response = httptools.downloadpage(page_url, cookies=False)
|
response = httptools.downloadpage(page_url, cookies=False)
|
||||||
cookie = {'Cookie': response.headers["set-cookie"]}
|
cookie = {'Cookie': response.headers["set-cookie"]}
|
||||||
data = response.data.replace("\\", "")
|
data = response.data.replace("\\", "")
|
||||||
subtitle = scrapertools.find_single_match(data, '"subtitles":.*?"es":.*?urls":\["([^"]+)"')
|
subtitle = scrapertools.find_single_match(data, r'"subtitles":.*?"es":.*?urls":\["([^"]+)"')
|
||||||
qualities = scrapertools.find_multiple_matches(data, '"([^"]+)":(\[\{"type":".*?\}\])')
|
qualities = scrapertools.find_multiple_matches(data, r'"([^"]+)":(\[\{"type":".*?\}\])')
|
||||||
for calidad, urls in qualities:
|
for calidad, urls in qualities:
|
||||||
patron = '"type":"(?:video|application)/([^"]+)","url":"([^"]+)"'
|
patron = '"type":"(?:video|application)/([^"]+)","url":"([^"]+)"'
|
||||||
matches = scrapertools.find_multiple_matches(urls, patron)
|
matches = scrapertools.find_multiple_matches(urls, patron)
|
||||||
@@ -31,12 +29,13 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
|||||||
if stream_type == "mp4":
|
if stream_type == "mp4":
|
||||||
stream_url = httptools.downloadpage(stream_url, headers=cookie, only_headers=True,
|
stream_url = httptools.downloadpage(stream_url, headers=cookie, only_headers=True,
|
||||||
follow_redirects=False).headers.get("location", stream_url)
|
follow_redirects=False).headers.get("location", stream_url)
|
||||||
else:
|
video_urls.append(["%sp .%s [dailymotion]" % (calidad, stream_type), stream_url, 0, subtitle])
|
||||||
data_m3u8 = httptools.downloadpage(stream_url).data
|
# else:
|
||||||
stream_url_http = scrapertools.find_single_match(data_m3u8, '(http:.*?\.m3u8)')
|
# data_m3u8 = httptools.downloadpage(stream_url).data
|
||||||
if stream_url_http:
|
# stream_url_http = scrapertools.find_single_match(data_m3u8, r'(http:.*?\.m3u8)')
|
||||||
stream_url = stream_url_http
|
# if stream_url_http:
|
||||||
video_urls.append(["%sp .%s [dailymotion]" % (calidad, stream_type), stream_url, 0, subtitle])
|
# stream_url = stream_url_http
|
||||||
|
# video_urls.append(["%sp .%s [Dailymotion]" % (calidad, stream_type), stream_url, 0, subtitle])
|
||||||
for video_url in video_urls:
|
for video_url in video_urls:
|
||||||
logger.info("%s - %s" % (video_url[0], video_url[1]))
|
logger.info("%s - %s" % (video_url[0], video_url[1]))
|
||||||
return video_urls
|
return video_urls
|
||||||
|
|||||||
Reference in New Issue
Block a user