Fix clipwatching

This commit is contained in:
Alhaziel01
2020-04-11 15:32:24 +02:00
parent 15bdd314ca
commit 13f0ba5bd2
2 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -15,7 +15,7 @@
}, },
"free": true, "free": true,
"id": "clipwatching", "id": "clipwatching",
"name": "clipwatching", "name": "Clipwatching",
"settings": [ "settings": [
{ {
"default": false, "default": false,
+10 -3
View File
@@ -17,16 +17,23 @@ def test_video_exists(page_url):
def get_video_url(page_url, user="", password="", video_password=""): def get_video_url(page_url, user="", password="", video_password=""):
logger.info("(page_url='%s')" % page_url) logger.info("(page_url='%s')" % page_url)
video_urls = [] video_urls = []
try: try:
packed = scrapertools.find_single_match(data, "text/javascript'>(eval.*?)\s*</script>") packed = scrapertools.find_single_match(data, "text/javascript'>(eval.*?)\s*</script>")
unpacked = jsunpack.unpack(packed) unpacked = jsunpack.unpack(packed)
except: except:
unpacked = scrapertools.find_single_match(data,"window.hola_player.*") unpacked = scrapertools.find_single_match(data,"window.hola_player.*")
videos = scrapertools.find_multiple_matches(unpacked, r'(?:file|src):\s*"([^"]+).*?label:\s*"([^"]+)')
videos = scrapertools.find_multiple_matches(unpacked if unpacked else data, r'(?:file|src|sources):\s*(?:\[)?"([^"]+).*?(?:label:\s*"([^"]+))?')
for video, label in videos: for video, label in videos:
if ".jpg" not in video: if ".jpg" not in video:
if not label.endswith('p'): if label and not label.endswith('p'):
label += 'p' label += 'p'
multires = True
else:
label = video.split('.')[-1]
multires = False
video_urls.append([label + " [clipwatching]", video]) video_urls.append([label + " [clipwatching]", video])
video_urls.sort(key=lambda it: int(it[0].split("p ", 1)[0])) if multires:
video_urls.sort(key=lambda it: int(it[0].split("p ", 1)[0]))
return video_urls return video_urls