Salve a tutti. Colgo l occasione per ringraziare colui che ha fatto questa guida.
Io avevo iniziato da poco e stavo cercando di realizzare qualche cosa. In particolare stavo cercando di aggiungere i link da [url]
http://www.eurostreaming.video/category/films/.
Código: Seleccionar todo
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<channel>
    <id>eurostreamingvideo</id>
    <name>Eurostreamingvideo</name>
    <active>true</active>
    <adult>false</adult>
    <language>it</language>
    <fanart></fanart>
    <thumbnail>http://www.eurostreaming.video/wp-content/themes/eurostreaming/images/logo.png</thumbnail>
    <bannermenu>http://www.eurostreaming.video/wp-content/themes/eurostreaming/images/logo.png</bannermenu>
    <update_url>https://raw.githubusercontent.com/streamondemand/plugin.video.streamondemand/master/channels/</update_url>
    <version>1</version>
    <date>24/09/2016</date>
    <changes>update</changes>
    <categories>
        <category>movie</category>
        <category>serie</category>
        <category>anime</category>
    </categories>
    <settings>
        <include_in_global_search>true</include_in_global_search>
    </settings>
</channel>
mentre il file .py
Código: Seleccionar todo
__channel__ = "eurostreamingvideo"
__category__ = "F"
__type__ = "generic"
__title__ = "Eurostreaming.video"
__language__ = "IT"
host = "http://www.eurostreaming.video"
headers = [
    ['User-Agent', 'Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0'],
    ['Accept-Encoding', 'gzip, deflate'],
    ['Referer', host]
]
DEBUG = config.get_setting("debug")
def isGeneric():
    return True
def mainlist(item):
    logger.info("streamondemand.eurostreamingvideo mainlist")
    itemlist = [Item(channel=__channel__,
                     title="[COLOR azure]Film[/COLOR]",
                     action="list_films",
                     url="%s/category/films/" % host,
                     thumbnail="https://s-media-cache-ak0.pinimg.com/originals/5b/e7/20/5be7200f111104bc1aa81b8cf1914356.jpg"),
                Item(channel=__channel__,
                     title="[COLOR azure]Serie TV[/COLOR]",
                     action="list_serie_tv",
                     url="%s/category/serie/" % host,
                     thumbnail="https://infoserietelevisive.files.wordpress.com/2014/06/cropped-serie-tv-logo1.png"),
                Item(channel=__channel__,
                     title="[COLOR azure]Anime-Cartoni[/COLOR]",
                     action="list_anime",
                     url="%s/category/anime-cartoni-animati/" % host,
                     thumbnail="http://www.animecel.eu/EN/immagini/Holly%20e%20Benji_001.jpg")]
    return itemlist
def list_films(item):
    logger.info("streamondemand.eurostreamingvideo list_films")
    itemlist = []
    data = scrapertools.cache_page(item.url)
    #Extrae las entradas (carpetas)
    patron = '<div class="container-index-post col-xs-6 col-sm-4 col-md-2-5 col-lg-2-5">.*?'
    patron += '<a href="([^"]+)">'
    patron += '<img src="([^"]+)"'
    matches = re.compile(patron, re.DOTALL).findall(data)
    for scrapedurl, scrapedthumbnail, scrapedtitle in matches:
        scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle)
        itemlist.append(infoSod(
            Item(channel=__channel__,
                 action="findvideos",
                 title=scrapedtitle,
                 url=scrapedurl,
                 thumbnail=urlparse.urljoin(host, scrapedthumbnail),
                 fulltitle=scrapedtitle,
                 show=scrapedtitle), tipo='movie'))
    # Paginación
    #next_page = scrapertools.find_single_match(data, '<span>\d+</span> <a href="([^"]+)">')
    #if next_page != "":
    #    itemlist.append(
    #        Item(channel=__channel__,
    #             action="serietv",
    #             title="[COLOR orange]Successivo >>[/COLOR]",
    #             url=next_page))
    return itemlist
Piccole curiosità che volevo chiedere:
- esiste una libreria tipo jsoup per il parsing Html in python?
- come faccio a testare/debuggare ?
- è possibile ricevere qualche info in più sul parsing da effettuare, perché non riesco a capire come muovermi tra i vari nodi.
Grazie mille per il lavoro che fate, avevo realizzato anche il file json che però è stato eliminato nell'ultima release.