Files
addon/servers/hclips.py
marco 3cdedad7e8 KoD 0.8.1
- riorganizzate le impostazioni
- aggiunte descrizioni tag qualità su cb01 (presto anche sugli altri)
- aggiunto il supporto alle serie di polpotv
- fixato server mystream
- fix Rinumerazione per episodi Nuovi
2020-03-14 17:03:57 +01:00

42 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
# --------------------------------------------------------
# Conector hclips By Alfa development Group
# --------------------------------------------------------
from core import httptools
from core import scrapertools
from platformcode import logger, config
def test_video_exists(page_url):
logger.info("(page_url='%s')" % page_url)
global data
data = httptools.downloadpage(page_url).data
if "<h2>WE ARE SORRY</h2>" in data or '<title>404 Not Found</title>' in data:
return False, config.get_localized_string(70449) % "hclips"
return True, ""
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
logger.info("url=" + page_url)
video_urls = []
url = "https://hclips.com/api/videofile.php?video_id=%s&lifetime=8640000" % page_url
headers = {'Referer': "https://hclips.com/embed/%s/" % page_url}
data = httptools.downloadpage(url, headers=headers).data
texto = scrapertools.find_single_match(data, 'video_url":"([^"]+)"')
url = dec_url(texto)
url = "https://hclips.com%s" % url
media_url = httptools.downloadpage(url, only_headers=True).url
video_urls.append(["[hclips]", media_url])
return video_urls
def dec_url(txt):
#truco del mendrugo
# txt = txt.replace('\u0410', 'A').replace('\u0412', 'B').replace('\u0421', 'C').replace('\u0415', 'E').replace('\u041c', 'M').replace('~', '=').replace(',','/')
txt = txt.decode('unicode-escape').encode('utf8')
txt = txt.replace('А', 'A').replace('В', 'B').replace('С', 'C').replace('Е', 'E').replace('М', 'M').replace('~', '=').replace(',','/')
import base64
url = base64.b64decode(txt)
return url