aabilio / PyDownTV2

Versión 2 (ahora "spaintvs") de la librería para obtener los enlaces de descarga de los vídeos de las webs de TVs españolas (PyDownTV). Y Script para ejemplo de uso. Además en desarrollo nueva web y versiones de Escritorio y Android
52 stars 34 forks source link

Serie Desenlace, colgada en Vertele #122

Closed ismanastic closed 10 years ago

ismanastic commented 10 years ago

Hola, como PyDown solo descarga vídeos de webs de televisión, no permite descargar esa serie inédita que ha puesto Vertele en su web. Sabéis si podéis hacer alguna modificación al programa para poder descargarla? Gracias!

aabilio commented 10 years ago

A ver si alguien se anima a programar vertele. De momento con este script:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import requests
import xml.etree.ElementTree

if __name__ == "__main__":
    search = requests.get('http://vms.api.qbrick.com/rest/v3/search/B4815C84/Desenlace')
    xmltree = xml.etree.ElementTree.fromstring(search.content)

    for i, item in enumerate(xmltree.iterfind('./media/')):
        vid_name = item.find('./title').text.encode('utf8')
        substream = item.find('./playlist/stream/format/substream').text.encode('utf8')

        sub = requests.get(substream)
        xmltree2 = xml.etree.ElementTree.fromstring(sub.content)
        meta = xmltree2.find('./head/meta').attrib["base"].encode('utf8').split("/")[-2]
        src = xmltree2.find('./body/switch/video').attrib["src"].encode('utf8').split("mp4:")[1:][0]
        bitrate = str(int(xmltree2.find('./body/switch/video').attrib["system-bitrate"].encode('utf8'))/1000)
        url2down = "http://www0.c03837.cdn.qbrick.com/%s/%s.mp4" % (meta, src.replace(' ', '%20').replace(bitrate,'aos'))

        if i==0:
            print "| TITLE | URL | SMIL |"
            print "| ----- | --- | ---- |"
        else:
            print "| %s | %s | %s |" % (vid_name, url2down, substream)

Sacas las urls de desenlace en SD:

TITLE URL SMIL
Desenlace Venenosos http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Venenosos_aos_ba3b3e89.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=AD96C75B&clipBegin=0&clipEnd=0&playListItemId=315696
Desenlace Vecino Mirón http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Vecino%20miron_aos_0751b2af.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=0E11B0A0&clipBegin=0&clipEnd=0&playListItemId=315689
Desenlace Santo Remedio http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Santo%20remedio_aos_bd0da581.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=A032BD56&clipBegin=0&clipEnd=0&playListItemId=315669
Desenlace Pito Final http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Pito%20final_aos_dd52bfe0.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=853B5CE1&clipBegin=0&clipEnd=0&playListItemId=315655
Desenlace La Última Cena http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/La%20_ltima%20cena_aos_0fa3628f.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=3942AEA1&clipBegin=0&clipEnd=0&playListItemId=315599
Desenlace La Entrega http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/La%20entrega_aos_7b36b9c8.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=1E795CD3&clipBegin=0&clipEnd=0&playListItemId=315585
Desenlace El Fontanero http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/El%20fontanero_aos_6ab29ae2.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=914CDB0A&clipBegin=0&clipEnd=0&playListItemId=315582
Desenlace El Comisario http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/El%20comisario_aos_eedf14e2.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=3D5AA2AB&clipBegin=0&clipEnd=0&playListItemId=315562
Desenlace El Autógrafo http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/El%20autografo_aos_274b7f80.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=0B6E618A&clipBegin=0&clipEnd=0&playListItemId=315551
Desenlace Doble Vida http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Doble%20vida_aos_885ccd74.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=545E7AB9&clipBegin=0&clipEnd=0&playListItemId=315548
Desenlace Trailer Largo http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Trailer%20Largo_aos_2a00541c.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=7060DD49&clipBegin=0&clipEnd=0&playListItemId=315523
Desenlace Trailer (I) http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Trailer%20Corto_aos_4b2f6c6a.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=3D55AA52&clipBegin=0&clipEnd=0&playListItemId=315516
Desenlace Casting http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Casting_aos_5f9b0676.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=C32A3DFD&clipBegin=0&clipEnd=0&playListItemId=315489
Desenlace Aficionados http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Aficionados_aos_006c4380.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=B3949B1E&clipBegin=0&clipEnd=0&playListItemId=315468
Desenlace Aniversario http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-22/Aniversario_aos_55523ab5.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=3497D2F0&clipBegin=0&clipEnd=0&playListItemId=315320
Desenlace Doble Vida http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-14/Doble%20vida_aos_af64568d.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=2B2A5A02&clipBegin=0&clipEnd=0&playListItemId=311442

Dejo la url de SMIL también para el que quiera intentar hacer dump del rtmp para una mayor calidad.

Saludos.

ismanastic commented 10 years ago

Eres un genio! No sé cómo lo has hecho, pero esta tarde me pongo al lío :P

ismanastic commented 10 years ago

Hola, tengo un problema. Uno de los vídeos está repetido...y precisamente el que falta es el último de la serie llamado "El suicida". Sería posible conseguirlo?

aabilio commented 10 years ago

ups! un bug en el script, que arreglado quedaría:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import requests
import xml.etree.ElementTree

if __name__ == "__main__":
    search = requests.get('http://vms.api.qbrick.com/rest/v3/search/B4815C84/Desenlace')
    xmltree = xml.etree.ElementTree.fromstring(search.content)

    for i, item in enumerate(xmltree.iterfind('./media/')):
        vid_name = item.find('./title').text.encode('utf8')
        substream = item.find('./playlist/stream/format/substream').text.encode('utf8')

        sub = requests.get(substream)
        xmltree2 = xml.etree.ElementTree.fromstring(sub.content)
        meta = xmltree2.find('./head/meta').attrib["base"].encode('utf8').split("/")[-2]
        src = xmltree2.find('./body/switch/video').attrib["src"].encode('utf8').split("mp4:")[1:][0]
        bitrate = str(int(xmltree2.find('./body/switch/video').attrib["system-bitrate"].encode('utf8'))/1000)
        url2down = "http://www0.c03837.cdn.qbrick.com/%s/%s.mp4" % (meta, src.replace(' ', '%20').replace(bitrate,'aos'))

        if i==0:
            print "| TITLE | URL | SMIL |"
            print "| ----- | --- | ---- |"
        print "| %s | %s | %s |" % (vid_name, url2down, substream)

Y cuya ejecución daría:

TITLE URL SMIL
Desenlace El Suicida http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-24/El%20Suicida_aos_8c2b1efb.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=13D7198A&clipBegin=0&clipEnd=0&playListItemId=315849
Desenlace Venenosos http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Venenosos_aos_ba3b3e89.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=AD96C75B&clipBegin=0&clipEnd=0&playListItemId=315696
Desenlace Vecino Mirón http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Vecino%20miron_aos_0751b2af.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=0E11B0A0&clipBegin=0&clipEnd=0&playListItemId=315689
Desenlace Santo Remedio http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Santo%20remedio_aos_bd0da581.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=A032BD56&clipBegin=0&clipEnd=0&playListItemId=315669
Desenlace Pito Final http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Pito%20final_aos_dd52bfe0.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=853B5CE1&clipBegin=0&clipEnd=0&playListItemId=315655
Desenlace La Última Cena http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/La%20_ltima%20cena_aos_0fa3628f.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=3942AEA1&clipBegin=0&clipEnd=0&playListItemId=315599
Desenlace La Entrega http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/La%20entrega_aos_7b36b9c8.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=1E795CD3&clipBegin=0&clipEnd=0&playListItemId=315585
Desenlace El Fontanero http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/El%20fontanero_aos_6ab29ae2.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=914CDB0A&clipBegin=0&clipEnd=0&playListItemId=315582
Desenlace El Comisario http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/El%20comisario_aos_eedf14e2.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=3D5AA2AB&clipBegin=0&clipEnd=0&playListItemId=315562
Desenlace El Autógrafo http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/El%20autografo_aos_274b7f80.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=0B6E618A&clipBegin=0&clipEnd=0&playListItemId=315551
Desenlace Doble Vida http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Doble%20vida_aos_885ccd74.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=545E7AB9&clipBegin=0&clipEnd=0&playListItemId=315548
Desenlace Trailer Largo http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Trailer%20Largo_aos_2a00541c.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=7060DD49&clipBegin=0&clipEnd=0&playListItemId=315523
Desenlace Trailer (I) http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Trailer%20Corto_aos_4b2f6c6a.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=3D55AA52&clipBegin=0&clipEnd=0&playListItemId=315516
Desenlace Casting http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Casting_aos_5f9b0676.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=C32A3DFD&clipBegin=0&clipEnd=0&playListItemId=315489
Desenlace Aficionados http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-23/Aficionados_aos_006c4380.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=B3949B1E&clipBegin=0&clipEnd=0&playListItemId=315468
Desenlace Aniversario http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-22/Aniversario_aos_55523ab5.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=3497D2F0&clipBegin=0&clipEnd=0&playListItemId=315320
Desenlace Doble Vida http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-04-14/Doble%20vida_aos_af64568d.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=2B2A5A02&clipBegin=0&clipEnd=0&playListItemId=311442

Donde ya está el suicida. Sorry. Saludos.

aabilio commented 10 years ago

A petición a través de email dejo esto aquí:

vertele.py:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import re
import requests
import xml.etree.ElementTree

if __name__ == "__main__":
    url = sys.argv[1]

    content = requests.get(url).content
    vids = re.findall("src=[\'\"](.*Embed.aspx.*?)[\'\"]", content)

    for i, v in enumerate(vids):
        mcid = re.findall("mcid=(.*?)&", v)[0]
        apiEndpoint = "http://vms.api.qbrick.com/rest/v3/getsingleplayer/%s?statusCode=xml" % (mcid)

        xmlResponse = requests.get(apiEndpoint)
        xmltree = xml.etree.ElementTree.fromstring(xmlResponse.content)
        vid_name = xmltree.find('./media/item/title').text.encode('utf8')
        substream = xmltree.find('./media/item/playlist/stream/format/substream').text.encode('utf8')

        xmlResponse2 = requests.get(substream)
        xmltree2 = xml.etree.ElementTree.fromstring(xmlResponse2.content)
        meta = xmltree2.find('./head/meta').attrib["base"].encode('utf8').split("/")[-2]
        src = xmltree2.find('./body/switch/video').attrib["src"].encode('utf8').split("mp4:")[1:][0]
        bitrate = str(int(xmltree2.find('./body/switch/video').attrib["system-bitrate"].encode('utf8'))/1000)
        url2down = "http://www0.c03837.cdn.qbrick.com/%s/%s.mp4" % (meta, src.replace(' ', '%20').replace(bitrate,'aos'))

        if i==0:
            print "| TITLE | URL | SMIL |"
            print "| ----- | --- | ---- |"
        print "| %s | %s | %s |" % (vid_name, url2down, substream)

Lanzando:

./vertele.py "http://www.vertele.com/noticias/los-protagonistas-de-el-principe-avanzan-el-final-tragico-que-quieren-y-las-burradas-que-les-dicen-los-fans/"

Se obtiene:

TITLE URL SMIL
Entrevista a Hiba Abouk (I) http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-06-09/Entrevista%20a%20Hiba%20Abouk%201_aos_043ff799.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=B6149872&clipBegin=0&clipEnd=0&playListItemId=387428
Entrevista a Hiba Abouk (II) http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-06-09/Entrevista%20a%20Hiba%20Abouk%202_aos_fa43c8bf.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=98D86CEC&clipBegin=0&clipEnd=0&playListItemId=387429
Entrevista a Álex González (I) http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-06-09/Entrevista%20a%20_lex%20Gonz_lez%201_aos_50a24fbe.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=CB47B1ED&clipBegin=0&clipEnd=0&playListItemId=387434
Entrevista a Álex González (II) http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-06-09/Entrevista%20a%20_lex%20Gonz_lez%202_aos_70692cf8.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=F04D2BFF&clipBegin=0&clipEnd=0&playListItemId=387436
Entrevista a Rubén Cortada (I) http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-06-09/Entrevista%20a%20Rub_n%20Cortada%201_aos_99e36b1f.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=BAF2F401&clipBegin=0&clipEnd=0&playListItemId=387431
Entrevista a Rubén Cortada (II) http://www0.c03837.cdn.qbrick.com/80407/ncode/2014-06-09/Entrevista%20a%20Rub_n%20Cortada%202_aos_3e688eb6.mp4 http://vms.api.qbrick.com/rest/v3/player.smil?cid=B4815C84&assetId=730B5A9D&clipBegin=0&clipEnd=0&playListItemId=387432

Saludos.