Estoy estancado necesito un ayuda por favor
Publicado: 14 Jun 2016, 16:21
Buenas, como estan espero que bien todos.
Estoy tratando de armar un canal nuevo, obtengo la lista de series(por ahora generos y alfabetico), obtengo los capitulos, pero a la hora de obtener los enlaces a los videos estaba medio complicado no se si de forma correcta pero consegui ubtener la url que usa la pagina, el tema es que la hora de buscar los videos no encuentra nada o directamente no los abre.... si uso la url que obtengo con el script en el navegador me lleva al video directamente... a lo mejor me estoy ahogando en un vaso de agua pero si me pueden ayudar un poco termino las demas opciones y tenemos un canal mas para agregar... ah ya me presente por otro lado en el foro pero igualmente aviso que no tengo muy claro el tema de los canales y estoy aplicando lo que voy aprendiendo. les paso el script a ver si alguien puede darme una mano
Estoy tratando de armar un canal nuevo, obtengo la lista de series(por ahora generos y alfabetico), obtengo los capitulos, pero a la hora de obtener los enlaces a los videos estaba medio complicado no se si de forma correcta pero consegui ubtener la url que usa la pagina, el tema es que la hora de buscar los videos no encuentra nada o directamente no los abre.... si uso la url que obtengo con el script en el navegador me lleva al video directamente... a lo mejor me estoy ahogando en un vaso de agua pero si me pueden ayudar un poco termino las demas opciones y tenemos un canal mas para agregar... ah ya me presente por otro lado en el foro pero igualmente aviso que no tengo muy claro el tema de los canales y estoy aplicando lo que voy aprendiendo. les paso el script a ver si alguien puede darme una mano
Código: Seleccionar todo
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# Canal (Anime Latino) por Hernan_Ar_c
# ------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os, sys
from core import logger
from core import config
from core import scrapertools
from core.item import Item
from servers import servertools
__channel__ = "animelatino"
__category__ = "A"
__type__ = "generic"
__title__ = "Animelatino"
__language__ = "ES"
DEBUG = config.get_setting("debug")
host="http://anime-latino.net"
def isGeneric():
return True
def mainlist(item):
logger.info("pelisalacarta.channels.animelatino mainlist")
itemlist = []
itemlist.append( Item(channel=__channel__, title="Generos", action="GEN", url=host))
itemlist.append( Item(channel=__channel__, title="Alfabetico", action="LET", url=host))
return itemlist
def TS(item):
logger.info("pelisalacarta.channels.animelatino TS")
itemlist = []
data = scrapertools.cache_page(item.url)
patron = '<div class="bl"> <a href="([^"]+)" title="([^"]+)"><img src="([^"]+)".*?class="im" /></a>'
# patron +='<a href="([^"]+)" title="([^"]+)">[^<]'
# patron +='<div class="poster_efecto"><span>([^<]+)<.*?div>[^<]'
# patron +='<img.*?src="([^"]+)"'
matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedurl,scrapedtitle,scrapedthumbnail in matches:
url = urlparse.urljoin(item.url,scrapedurl)
title = scrapedtitle
thumbnail = host+scrapedthumbnail
plot = ""
if (DEBUG): logger.info("title=["+title+"], url=["+url+"], thumbnail=["+thumbnail+"])")
itemlist.append( Item(channel=__channel__, action="TS" , title=title , url=url, thumbnail=thumbnail, plot=plot))
return itemlist
#Paginacion
# patron = '<li><a class="next page-numbers local-link" href="([^"]+)">».*?li>'
# next_page_url = scrapertools.find_single_match(data,'<li><a class="next page-numbers local-link" href="([^"]+)">».*?li>')
# if next_page_url!="":
# import inspect
# itemlist.append(
# Item(
# channel = __channel__,
# action = "TS",
# title = ">> Página siguiente",
# url = urlparse.urljoin( item.url, next_page_url )
# )
# )
# return itemlist
def GEN(item):
logger.info("pelisalacarta.channels.animelatino GEN")
itemlist = []
data = scrapertools.cache_page(item.url)
patron = '<li><a href="/genero([^"]+)" class="let">([^<]+)</a></li>'
# patron = '<li class=".*?="([^"]+)".*?>([^<]+)</a>'
matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedurl,scrapedtitle in matches:
url = urlparse.urljoin(item.url,"genero"+scrapedurl)
title = scrapedtitle
# title = title.replace("&","x");
thumbnail = ""
plot = ""
if (DEBUG): logger.info("title=["+title+"], url=["+url+"], thumbnail=["+thumbnail+"])")
itemlist.append( Item(channel=__channel__, action="LISTA" , title=title , url=url, thumbnail=thumbnail, plot=plot))
return itemlist
def LET(item):
logger.info("pelisalacarta.channels.animelatino LET")
itemlist = []
data = scrapertools.cache_page(item.url)
patron = '<li><a href="/letra([^"]+)" class="let">([^<]+)</a></li>'
# patron = '<li class=".*?="([^"]+)".*?>([^<]+)</a>'
matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedurl,scrapedtitle in matches:
url = urlparse.urljoin(item.url,"letra"+scrapedurl)
title = scrapedtitle
# title = title.replace("&","x");
thumbnail = ""
plot = ""
if (DEBUG): logger.info("title=["+title+"], url=["+url+"], thumbnail=["+thumbnail+"])")
itemlist.append( Item(channel=__channel__, action="LISTA" , title=title , url=url, thumbnail=thumbnail, plot=plot))
return itemlist
def LISTA(item):
logger.info("pelisalacarta.channels.animelatino LISTA")
itemlist = []
data = scrapertools.cache_page(item.url)
item.url=host
patron = '<div class="bl"> <a href=".*?/anime([^"]+)" title="([^"]+)"><img src="([^"]+)" alt=.*?/a>'
# patron = '<li class=".*?="([^"]+)".*?>([^<]+)</a>'
matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedurl,scrapedtitle,scrapedthumbnail in matches:
url = urlparse.urljoin(item.url,"anime"+scrapedurl)
title = scrapedtitle
# title = title.replace("&","x");
thumbnail = host+scrapedthumbnail
plot = ""
if (DEBUG): logger.info("title=["+title+"], url=["+url+"], thumbnail=["+thumbnail+"])")
itemlist.append( Item(channel=__channel__, action="EP" , title=title , url=url, thumbnail=thumbnail, plot=plot))
return itemlist
def EP(item):
logger.info("pelisalacarta.channels.animelatino EP")
itemlist = []
data = scrapertools.cache_page(item.url)
item.url = host
patron = '<li class="lcc"><a href=".*?ver([^"]+)" class="lcc">([^<]+)</a></li>'
matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedurl,scrapedtitle in matches:
url = urlparse.urljoin(item.url,"ver"+scrapedurl)
title = scrapedtitle
thumbnail = item.thumbnail
plot = ""
if (DEBUG): logger.info("title=["+title+"], url=["+url+"], thumbnail=["+thumbnail+"])")
itemlist.append( Item(channel=__channel__, action="link" , title=title , url=url, thumbnail=thumbnail, plot=plot))
return itemlist
def link(item):
logger.info("pelisalacarta.channels.animelatino link")
itemlist=[]
lista = {"videoVTLPS":"http://www.4shared.com/web/embed/file/","videoVTLPSync":"http://www.4sync.com/web/embed/file/","videoVTLPFlv":"http://www.4shared.com/web/embed/file/","videoVTLPSh":"http://www.4shared.com/web/embed/file/","videoVTLPShh":"http://www.4shared.com/web/embed/file/","videoVTLPSv":"http://www.anime-latino.net/server/stream/sendjw.php?id=","videoVTLPMp":"http://www.anime-latino.net/server/stream/mp4.php?id=","videoVTLPCl":"http://cloud.mail.ru/public/","videoVTLPK":"/server/stream/pica.php?id=","videoVTLPGl":"http://www.anime-latino.net/server/stream/go.php?id=","videoVTLPZ":"http://www.anime-latino.net/server/stream/iza.php?id=","videoVTLPYoga":"http://www.anime-latino.net/server/stream/yoga.php?id=","videoVTLPKami":"http://anime-latino.net/server/stream/kami.php?id=","videoVTLPAz":"http://anime-latino.net/server/stream/amazon.php?id=","videoVTLPAmz":"//my.mp4link.com/embed/amazonv1/code=","videoVTLPVm":"http://anime-latino.net/server/stream/vimeo.php?id=","videoVTLPYr":"http://anime-latino.net/server/stream/your.php?id=","videoVTLPX":"http://anime-latino.net/server/stream/video.php?id=","videoVTLPZp":"http://anime-latino.net/server/gkzp/?zp=","videoVTLPDcg":"https://docs.google.com/file/d/","videoVTLPOk":"http://ok.ru/videoembed/","videoVTLPVidzi":"http://vidzi.tv/embed-","videoVTLPOpen":"https://openload.co/embed","videoVTLPVimple":"http://player.vimple.ru/content/preloader.swf?id=","videoVTLPDay":"//www.dailymotion.com/swf/","videoVTLPNetu":"http://hqq.tv/player/embed_player.php?vid=","videoVTLPVk":"http://f6.videosxd.org/v.php?v=","videoVTLPIframe":"http://anime-latino.net/","videoVTLPYoutube":"http://anime-latino.net/server/stream/html5.php?x=","videoVTLPMyspace":"https://myspace.com/play/video/","videoVTLPRutube":"http://rutube.ru/play/embed/","videoVTLPFacebook":"http://anime-latino.net/server/facebook.php?vidatraslapc=1&reproductor="}
data = scrapertools.cache_page(item.url)
'''<script type="text/javascript">videoVTLPRutube('4578364');</script>'''
patron = '<script type = \'text/javascript\'>([^\(]+)\(\'([^\']+)\'\);</script>'
matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedtitle, scrapedurl in matches:
scrapedtitle = scrapedtitle.strip(' ')
if lista.has_key(scrapedtitle):
url=lista[scrapedtitle]+scrapedurl
title = "ver en "+url
thumbnail = ""
plot = ""
if (DEBUG): logger.info("title=["+title+"], url=["+url+"], thumbnail=["+thumbnail+"])")
itemlist.append( Item(channel=__channel__, action="findvideos" , title=title , url=url, thumbnail=thumbnail, plot=plot))
'''<script type="text/javascript">videoVTLPRutube('4578364');</script>'''
patron = '<script type="text\/javascript\">([^\(]+)\(\'([^\']+)\'\);<\/script>'
matches = re.compile(patron,re.DOTALL).findall(data)
for scrapedtitle, scrapedurl in matches:
scrapedtitle = scrapedtitle.strip(' ')
if lista.has_key(scrapedtitle):
url = lista[scrapedtitle]+scrapedurl
title = "ver en "+url
thumbnail = ""
plot = ""
if (DEBUG): logger.info("title=["+title+"], url=["+url+"], thumbnail=["+thumbnail+"])")
itemlist.append( Item(channel=__channel__, action="findvideos" , title=title , url=url, thumbnail=thumbnail, plot=plot))
return itemlist