Fix clipwatching

This commit is contained in:
Alhaziel01
2020-04-11 15:32:24 +02:00
parent ec3fb47141
commit 98ecf30d00
2 changed files with 11 additions and 4 deletions

View File

@@ -15,7 +15,7 @@
},
"free": true,
"id": "clipwatching",
"name": "clipwatching",
"name": "Clipwatching",
"settings": [
{
"default": false,

View File

@@ -17,16 +17,23 @@ def test_video_exists(page_url):
def get_video_url(page_url, user="", password="", video_password=""):
logger.info("(page_url='%s')" % page_url)
video_urls = []
try:
packed = scrapertools.find_single_match(data, "text/javascript'>(eval.*?)\s*</script>")
unpacked = jsunpack.unpack(packed)
except:
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:
if ".jpg" not in video:
if not label.endswith('p'):
if label and not label.endswith('p'):
label += 'p'
multires = True
else:
label = video.split('.')[-1]
multires = False
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