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
This commit is contained in:
Regular → Executable
+19
-13
@@ -1,29 +1,35 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import urllib
|
||||
|
||||
from core import httptools
|
||||
from core import scrapertools
|
||||
from platformcode import logger
|
||||
from lib import jsunpack
|
||||
|
||||
id_server = "vidtodo"
|
||||
response = ""
|
||||
def test_video_exists(page_url):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
global response
|
||||
response = httptools.downloadpage(page_url)
|
||||
if not response.sucess or "Not Found" in response.data:
|
||||
return False, "[%s] El fichero no existe o ha sido borrado" %id_server
|
||||
if not response.sucess or "Video is processing now." in response.data:
|
||||
return False, "[%s] El video se está procesando." %id_server
|
||||
return True, ""
|
||||
|
||||
|
||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
video_urls = []
|
||||
data = httptools.downloadpage(page_url).data
|
||||
data = data.replace('"', "'")
|
||||
page_url_post = find_single_match(data, "<Form method='POST' action='([^']+)'>")
|
||||
imhuman = "&imhuman=" + find_single_match(data, "name='imhuman' value='([^']+)'").replace(" ", "+")
|
||||
post = urllib.urlencode({k: v for k, v in find_multiple_matches(data, "name='([^']+)' value='([^']*)'")}) + imhuman
|
||||
time.sleep(1)
|
||||
data = httptools.downloadpage(page_url_post, post=post).data
|
||||
sources = scrapertools.find_single_match(data, 'sources: \[([^\]]+)\]')
|
||||
for media_url in find_multiple_matches(sources, '"([^"]+)"'):
|
||||
data = response.data
|
||||
packed_data = scrapertools.find_single_match(data, "javascript'>(eval.*?)</script>")
|
||||
unpacked = jsunpack.unpack(packed_data)
|
||||
matches = scrapertools.find_multiple_matches(unpacked, 'src:"([^"]+)",type:"video/(.*?)",res:(.*?),')
|
||||
for media_url, type, res in matches:
|
||||
if media_url.endswith(".mp4"):
|
||||
video_urls.append([".mp4 [%s]" % id_server, media_url])
|
||||
video_urls.append(["[%s][%s]" % (type, res), media_url])
|
||||
if media_url.endswith(".m3u8"):
|
||||
video_urls.append(["M3U8 [%s]" % id_server, media_url])
|
||||
video_urls.append(["M3U8 [%s][%s]" % (type, res), media_url])
|
||||
if media_url.endswith(".smil"):
|
||||
smil_data = httptools.downloadpage(media_url).data
|
||||
rtmp = scrapertools.find_single_match(smil_data, 'base="([^"]+)"')
|
||||
|
||||
Reference in New Issue
Block a user