From 1acc1efc26b8088eacc4a9a0b44f0aea6a1f8047 Mon Sep 17 00:00:00 2001 From: Alfa <30527549+alfa-addon@users.noreply.github.com> Date: Wed, 30 Jan 2019 14:49:26 -0500 Subject: [PATCH] thevimeo: nuevo conector --- plugin.video.alfa/servers/thevimeo.json | 42 +++++++++++++++++++++++++ plugin.video.alfa/servers/thevimeo.py | 41 ++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 plugin.video.alfa/servers/thevimeo.json create mode 100644 plugin.video.alfa/servers/thevimeo.py diff --git a/plugin.video.alfa/servers/thevimeo.json b/plugin.video.alfa/servers/thevimeo.json new file mode 100644 index 00000000..360159ff --- /dev/null +++ b/plugin.video.alfa/servers/thevimeo.json @@ -0,0 +1,42 @@ +{ + "active": true, + "find_videos": { + "ignore_urls": [], + "patterns": [ + { + "pattern": "(https://thevimeo.pw/[a-zA-Z0-9]+)", + "url": "\\1" + } + ] + }, + "free": true, + "id": "thevimeo", + "name": "thevimeo", + "settings": [ + { + "default": false, + "enabled": true, + "id": "black_list", + "label": "@60654", + "type": "bool", + "visible": true + }, + { + "default": 0, + "enabled": true, + "id": "favorites_servers_list", + "label": "@60655", + "lvalues": [ + "No", + "1", + "2", + "3", + "4", + "5" + ], + "type": "list", + "visible": false + } + ], + "thumbnail": "https://smmsquare.com/wp-content/uploads/2017/12/Vimeo_smmsquare.png" +} diff --git a/plugin.video.alfa/servers/thevimeo.py b/plugin.video.alfa/servers/thevimeo.py new file mode 100644 index 00000000..a737d231 --- /dev/null +++ b/plugin.video.alfa/servers/thevimeo.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# -*- Server Thevimeo -*- + +import re +from core import httptools +from core import scrapertools +from platformcode import logger + + +def get_source(url): + #logger.info() + data = httptools.downloadpage(url).data + data = re.sub(r'"|\n|\r|\t| |
|\s{2,}', "", data) + return data + +def test_video_exists(page_url): + #logger.info("(page_url='%s')" % page_url) + data = get_source(page_url) + + if "File was deleted" in data or "File Not Found" in data: + return False, "[Thevimeo] El video ha sido borrado" + + return True, "" + + +def get_video_url(page_url, premium=False, user="", password="", video_password=""): + #logger.info("url=" + page_url) + video_urls = [] + data = get_source(page_url) + #logger.debug(data) + patron = "{file:(.*?),label:(.*?)," + + matches = re.compile(patron, re.DOTALL).findall(data) + #url = scrapertools.find_single_match(data, "sources.*?{file:(.*?),") + for url, qual in matches: + url = url.replace("\/", "/") + qual = qual.replace("M\u00f3vil","360") + video_urls.append([qual+"p [Thevimeo]", url]) + video_urls.sort(key=lambda it: int(it[0].split("p ", 1)[0])) + + return video_urls