Fix Server ClipWatching

This commit is contained in:
Alhaziel
2019-11-13 11:37:51 +01:00
parent 04e0013780
commit 6cb3683875
2 changed files with 14 additions and 13 deletions
+3 -7
View File
@@ -4,18 +4,14 @@
"ignore_urls": [],
"patterns": [
{
"pattern": "clipwatching.com/(e.*?.html)",
"url": "http://clipwatching.com/\\1"
},
{
"pattern": "clipwatching.com/(\\w+)",
"pattern": "clipwatching.com/(?:embed-)?([a-zA-Z0-9]+).html",
"url": "http://clipwatching.com/embed-\\1.html"
}
]
},
"free": true,
"id": "clipwatching",
"name": "clipwatching",
"name": "ClipWatching",
"settings": [
{
"default": false,
@@ -42,5 +38,5 @@
"visible": false
}
],
"thumbnail": "https://s17.postimg.cc/e6kcan0vj/clipwatching1.png"
"thumbnail": "server_clipwatching.png"
}
+11 -6
View File
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import re
from core import httptools
from core import scrapertools
from lib import jsunpack
@@ -17,12 +18,16 @@ def test_video_exists(page_url):
def get_video_url(page_url, user="", password="", video_password=""):
logger.info("(page_url='%s')" % page_url)
data = httptools.downloadpage(page_url).data
packed = scrapertools.find_single_match(data, "text/javascript'>(.*?)\s*</script>")
unpacked = jsunpack.unpack(packed)
data = re.sub('\t|\n','',data)
logger.info('CLIP DATA= ' + data)
packed = scrapertools.find_single_match(data, r"text/javascript'>(.*?)\s*</script>")
try: unpacked = jsunpack.unpack(packed)
except: unpacked = data
video_urls = []
videos = scrapertools.find_multiple_matches(unpacked, 'file:"([^"]+).*?label:"([^"]+)')
for video, label in videos:
videos = scrapertools.find_multiple_matches(unpacked, r'(?:file|src):\s*"([^"]+).*?type:\s*"video/([^"]+)".*?label:\s*"([^"]+)')
for video, Type, label in videos:
logger.info(Type)
logger.info(label)
if ".jpg" not in video:
video_urls.append([label + " [clipwatching]", video])
video_urls.sort(key=lambda it: int(it[0].split("p ", 1)[0]))
video_urls.append(['%s [%sp] [ClipWatching]' % (Type, label), video])
return video_urls