27 lines
926 B
Python
27 lines
926 B
Python
# -*- coding: utf-8 -*-
|
|
from core import httptools
|
|
from core import scrapertools
|
|
from platformcode import config
|
|
from platformcode import logger
|
|
|
|
|
|
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) % "tube8"
|
|
return True, ""
|
|
|
|
|
|
def get_video_url(page_url, video_password):
|
|
logger.info("(page_url='%s')" % page_url)
|
|
video_urls = []
|
|
data = httptools.downloadpage(page_url).data
|
|
patron = '"quality":(\d+),"videoUrl":"([^"]+)"'
|
|
matches = scrapertools.find_multiple_matches(data, patron)
|
|
for quality, scrapedurl in matches:
|
|
url = scrapedurl.replace("\/", "/").replace("\u0026", "&")
|
|
video_urls.append(["[tube8] %sp" %quality, url])
|
|
return video_urls
|