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
+44
-29
@@ -9,36 +9,26 @@ def test_video_exists(page_url):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
|
||||
real_url = page_url.replace("uploaded.to", "uploaded.net")
|
||||
# Vídeo borrado: uploaded.to/file/q4rkg1rw -> Redirige a otra página uploaded.to/410/q4rkg1rw
|
||||
# Video erróneo: uploaded.to/file/q4rkg1rx -> Redirige a otra página uploaded.to/404
|
||||
location = httptools.downloadpage(real_url, follow_redirects=False, only_headers=True).headers.get("location", "")
|
||||
logger.info("location=" + location)
|
||||
if location:
|
||||
return True, ""
|
||||
elif "uploaded.net/410" in location:
|
||||
return False, "El archivo ya no está disponible<br/>en uploaded.to (ha sido borrado)"
|
||||
elif "uploaded.net/404" in location:
|
||||
return False, "El archivo no existe<br/>en uploaded.to (enlace no válido)"
|
||||
code = httptools.downloadpage(real_url, only_headers=True).code
|
||||
if code > 200:
|
||||
return False,"Archivo eliminado o inexistente"
|
||||
else:
|
||||
return True, ""
|
||||
|
||||
|
||||
|
||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||
logger.info("(page_url='%s')" % page_url)
|
||||
video_urls = []
|
||||
if premium:
|
||||
#Si no hay almacenada una cookie activa, hacemos login
|
||||
if check_cookie("uploaded.net", "login") != True:
|
||||
|
||||
# Login para conseguir la cookie
|
||||
logger.info("-------------------------------------------")
|
||||
logger.info("login")
|
||||
logger.info("-------------------------------------------")
|
||||
login_url = "http://uploaded.net/io/login"
|
||||
post = "id=" + user + "&pw=" + password
|
||||
headers = []
|
||||
headers.append(["X-Requested-With", "XMLHttpRequest"])
|
||||
headers.append(["X-Prototype-Version", "1.6.1"])
|
||||
headers.append(["Referer", "http://uploaded.to/"])
|
||||
|
||||
setcookie = httptools.downloadpage(login_url, post=post, headers=headers, follow_redirects=False,
|
||||
logger.info("-------------------------------------------")
|
||||
logger.info("login")
|
||||
logger.info("-------------------------------------------")
|
||||
login_url = "http://uploaded.net/io/login"
|
||||
post = "id=" + user + "&pw=" + password
|
||||
setcookie = httptools.downloadpage(login_url, post=post, follow_redirects=False,
|
||||
only_headers=True).headers.get("set-cookie", "")
|
||||
|
||||
logger.info("-------------------------------------------")
|
||||
@@ -48,17 +38,28 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
||||
location = httptools.downloadpage(page_url, follow_redirects=False, only_headers=True).headers.get("location",
|
||||
"")
|
||||
logger.info("location=" + location)
|
||||
# Set-Cookie3: auth=3315964ab4fac585fdd9d4228dc70264a1756ba; path="/"; domain=".uploaded.to"; path_spec; domain_dot; expires="2015-02-25 18:35:37Z"; version=0
|
||||
# Set-Cookie3: login="%26id%3D3315964%26pw%3Dde135af0befa087e897ee6bfa78f2511a1ed093f%26cks%3D854cca559368"; path="/"; domain=".uploaded.to"; path_spec; domain_dot; expires="2013-02-25 18:35:37Z"; version=0
|
||||
|
||||
|
||||
#fix descarga no directa
|
||||
if location == "":
|
||||
data = httptools.downloadpage(page_url).data
|
||||
#logger.info("data: %s" % data)
|
||||
if "<h1>Premium Download</h1>" in data:
|
||||
location = scrapertools.find_single_match(data, '<form method="post" action="([^"]+)"')
|
||||
#logger.info("location: %s" % location)
|
||||
elif "Hybrid-Traffic is completely exhausted" in data:
|
||||
logger.error("Trafico agotado")
|
||||
|
||||
elif "<h1>Free Download</h1>" in data:
|
||||
logger.error("Cuenta Free")
|
||||
else:
|
||||
logger.error("Error Desconocido")
|
||||
logger.info("-------------------------------------------")
|
||||
logger.info("obtiene el nombre del fichero")
|
||||
logger.info("-------------------------------------------")
|
||||
try:
|
||||
# content-disposition=attachment; filename="El Hobbit CAM LATINO Barbie.avi"
|
||||
content_disposition = httptools.downloadpage(location, headers=headers, follow_redirects=False,
|
||||
content_disposition = httptools.downloadpage(location, post="", follow_redirects=False,
|
||||
only_headers=True).headers.get("content-disposition", "")
|
||||
logger.info("content_disposition=" + repr(content_disposition))
|
||||
logger.info("content_disposition=" + content_disposition)
|
||||
if content_disposition != "":
|
||||
filename = scrapertools.find_single_match(content_disposition, 'filename="([^"]+)"')
|
||||
extension = filename[-4:]
|
||||
@@ -76,3 +77,17 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
|
||||
logger.info("%s - %s" % (video_url[0], video_url[1]))
|
||||
|
||||
return video_urls
|
||||
|
||||
def check_cookie(domain, cname):
|
||||
from platformcode import config
|
||||
#cargamos las cookies
|
||||
cookies = config.get_cookie_data()
|
||||
#buscamos el valor de la cookie "cname" del dominio "domain"
|
||||
cookie_value = scrapertools.find_single_match(cookies, domain + ".*?" + cname + "\s+([A-Za-z0-9\+\=\%\_]+)")
|
||||
if cookie_value:
|
||||
if len(cookie_value) > 6:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user