diff --git a/servers/clipwatching.json b/servers/clipwatching.json index 2e80d637..4d455db9 100644 --- a/servers/clipwatching.json +++ b/servers/clipwatching.json @@ -15,7 +15,7 @@ }, "free": true, "id": "clipwatching", - "name": "clipwatching", + "name": "Clipwatching", "settings": [ { "default": false, diff --git a/servers/clipwatching.py b/servers/clipwatching.py index 8e8d962f..93aa4804 100644 --- a/servers/clipwatching.py +++ b/servers/clipwatching.py @@ -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*") 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