44 lines
1.6 KiB
Python
44 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
# --------------------------------------------------------
|
|
# Conector javwhores By Alfa development Group
|
|
# --------------------------------------------------------
|
|
import re
|
|
|
|
from core import httptools
|
|
from platformcode import config
|
|
from platformcode import logger
|
|
|
|
|
|
def test_video_exists(page_url):
|
|
|
|
response = httptools.downloadpage(page_url)
|
|
|
|
if not response.sucess or \
|
|
"Not Found" in response.data \
|
|
or "File was deleted" in response.data \
|
|
or "is no longer available" in response.data:
|
|
return False, config.get_localized_string(70449) % "javwhores"
|
|
|
|
# global video_url, license_code
|
|
# video_url = scrapertools.find_single_match(response.data, "video_url: '([^']+)'")
|
|
# license_code = scrapertools.find_single_match(response.data, "license_code: '([^']+)'")
|
|
return True, ""
|
|
|
|
|
|
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
|
logger.info()
|
|
itemlist = []
|
|
data = httptools.downloadpage(page_url).data
|
|
if "video_url_text" in data:
|
|
patron = '(?:video_url|video_alt_url|video_alt_url[0-9]*):\s*\'([^\']+)\'.*?'
|
|
patron += '(?:video_url_text|video_alt_url_text|video_alt_url[0-9]*_text):\s*\'([^\']+)\''
|
|
else:
|
|
patron = 'video_url:\s*\'([^\']+)\'.*?'
|
|
patron += 'postfix:\s*\'([^\']+)\''
|
|
matches = re.compile(patron,re.DOTALL).findall(data)
|
|
for url,quality in matches:
|
|
itemlist.append(['%s' %quality, url])
|
|
logger.debug(quality + " : " + url)
|
|
|
|
return itemlist
|
|
# return [["[javwhores]", decode(video_url, license_code)]] |