bosel / plugin.video.nederland24

Kodi Addon Nederland24
GNU General Public License v3.0
7 stars 14 forks source link

Seems NPO streams return a 410 as of today #24

Closed sphaero closed 7 years ago

sphaero commented 7 years ago

from kodi.log:

18:57:55 T:2623534144  NOTICE: -->Python Interpreter Initialized<--
18:57:56 T:2623534144  NOTICE: plugin.video.nederland24:: Starting Addon
18:57:56 T:2623534144  NOTICE: plugin.video.nederland24:: NPO Radio 1 not set
18:57:56 T:2623534144  NOTICE: plugin.video.nederland24:: NPO Radio 2 not set
18:57:56 T:2623534144  NOTICE: plugin.video.nederland24:: NPO 3FM not set
18:57:56 T:2623534144  NOTICE: plugin.video.nederland24:: NPO Radio 4 not set
18:57:56 T:2623534144  NOTICE: plugin.video.nederland24:: NPO Radio 6 not set
18:57:56 T:2623534144  NOTICE: plugin.video.nederland24:: NPO FunX not set
18:57:59 T:2623534144  NOTICE: plugin.video.nederland24:: No additional channels set
18:58:02 T:2623534144  NOTICE: Thread LanguageInvoker start, auto delete: false
18:58:02 T:2623534144  NOTICE: -->Python Interpreter Initialized<--
18:58:03 T:2623534144  NOTICE: plugin.video.nederland24:: Starting Addon
18:58:03 T:2623534144   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'urllib2.HTTPError'>
                                            Error Contents: HTTP Error 410: Gone
                                            Traceback (most recent call last):
                                              File "/home/pi/.kodi/addons/plugin.video.nederland24/nederland24.py", line 246, in <module>
                                                playVideo(url)
                                              File "/home/pi/.kodi/addons/plugin.video.nederland24/nederland24.py", line 213, in playVideo
                                                URL = API_URL+BASE_URL+media+"&token=%s" % collect_token()
                                              File "/home/pi/.kodi/addons/plugin.video.nederland24/nederland24.py", line 146, in collect_token
                                                response = urllib2.urlopen(req)
                                              File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
                                                return _opener.open(url, data, timeout)
                                              File "/usr/lib/python2.7/urllib2.py", line 407, in open
                                                response = meth(req, response)
                                              File "/usr/lib/python2.7/urllib2.py", line 520, in http_response
                                                'http', request, response, code, msg, hdrs)
                                              File "/usr/lib/python2.7/urllib2.py", line 445, in error
                                                return self._call_chain(*args)
                                              File "/usr/lib/python2.7/urllib2.py", line 379, in _call_chain
                                                result = func(*args)
                                              File "/usr/lib/python2.7/urllib2.py", line 528, in http_error_default
                                                raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
                                            HTTPError: HTTP Error 410: Gone
                                            -->
mrarends commented 7 years ago

NPO have changed some URL's around. I have changed some code to make it work again. But it is my first time using GitHub so searching for a way to upload my change :)

sciurius commented 7 years ago

In case of emergency, cut/paste as comment here :)

mrarends commented 7 years ago

Here is the content of nederland24.py

#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of plugin.video.nederland24 ("Nederland24")

# Nederland24 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# Nederland24 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with Nederland24.  If not, see <http://www.gnu.org/licenses/>.

import os
import xbmc, xbmcgui, xbmcplugin, xbmcaddon
import urllib
import urllib2
import re
import urlparse
import httplib
from BeautifulSoup import BeautifulStoneSoup, SoupStrainer

xbmc.log("plugin.video.nederland24:: Starting Addon")

###
addon = xbmcaddon.Addon()
addonId = addon.getAddonInfo('id')

pluginhandle = int(sys.argv[1])
settings = xbmcaddon.Addon(id='plugin.video.nederland24')
xbmcplugin.setContent(pluginhandle, 'episodes')
# xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_EPISODE)  #enable for alphabetic listing
IMG_DIR = os.path.join(settings.getAddonInfo("path"), "resources", "media")

###
API_URL = 'http://ida.omroep.nl/app.php/'
BASE_URL = 'http://livestreams.omroep.nl/live/npo/'
#USER_AGENT = 'Mozilla/5.0 (iPad; CPU OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B410 Safari/600.1.4'
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12'
REF_URL = 'http://www.npo.nl'
TOKEN_URL = 'http://ida.omroep.nl/app.php/auth'

CHANNELS = [

  ["NPO 1", "npo_1.png", "LI_NL1_4188102", "Televisiekijken begint op NPO 1. Van nieuws en actualiteiten tot consumentenprogramma's en kwaliteitsdrama. Programma's die over jou en jouw wereld gaan. Met verhalen die je herkent over mensen die zomaar in je straat kunnen wonen. Ook als er iets belangrijks gebeurt, in Nederland of in de wereld, kijk je NPO 1."],
  ["NPO 2", "npo_2.png", "LI_NL2_4188105", "NPO 2 zet je aan het denken. Met programma's die verdiepen en inspireren. Als je wilt weten wat het verhaal achter de actualiteit is. Of als je het eens van een andere kant wilt bekijken. NPO 2 biedt het mooiste van Nederlandse en internationale kunst en cultuur, literatuur, documentaires, art-house films en kwaliteitsdrama."],
  ["NPO 3", "npo_3.png", "LI_NL3_4188107", "Op NPO 3 vind je programma's waar jong Nederland zich in herkent en die je uitdagen een eigen mening te vormen. Met veel aandacht voor nieuwe media en experimentele vernieuwing brengt NPO 3 een gevarieerd aanbod van de dagelijkse actualiteit tot muziek, reizen, human interest, talkshows en documentaires."],
  ["NPO 101", "npo_101.png", "LI_NEDERLAND3_221683", "Weg met suffe en saaie tv! Het is tijd voor NPO 101, het 24-uurs jongerenkanaal van BNN en de Publieke Omroep. Met rauwe en brutale programma's, van en voor jongeren. Boordevol hilarische fragmenten, spannende livegames, bizarre experimenten en nieuws over festivals en gratis concertkaartjes. Kijken dus!"],
#  ["NPO Best", "npo_best.png", "thematv/best24/best24.isml/best24.m3u8", "NPO Best brengt hoogtepunten uit ruim zestig jaar Nederlandse televisiehistorie. Het is een feelgoodzender waarop u 24 uur per dag de mooiste programma's uit de schatkamer van de Publieke Omroep kunt zien."],
  ["NPO Cultura", "npo_cultura.png", "LI_NEDERLAND2_221679", "NPO Cultura is het digitale themakanaal van de Publieke Omroep voor verdieping in kunst en cultuur. 24 uur per dag programma's uit genres als klassiek, literatuur, dans, theater, pop, jazz, film, drama en beeldende kunst."],
  ["NPO Zapp Xtra", "npo_zapp.png", "LI_NEDERLAND3_221687", "Zappelin Xtra en Zapp Xtra zendt dagelijks, 24 uur per dag en reclamevrij, de beste kinderprogramma's van de publieke omroep uit. Aansluitend op Nederland 3 zendt het themakanaal programma's uit van Zappelin of Zapp. Is op Nederland 3 iets voor kleuters te zien dan richt het themakanaal zich op oudere kinderen, en andersom."],
#  ["NPO Doc", "npo_doc.png", "thematv/hollanddoc24/hollanddoc24.isml/hollanddoc24.m3u8", "NPO Doc is het documentaireplatform van de NPO en verrast je continu met de beste documentaires uit binnen- en buitenland en exclusieve interviews met regisseurs en topwetenschappers."],
#  ["NPO Humor TV", "npo_humor_tv.png", "thematv/humor24/humor24.isml/humor24.m3u8", "NPO Humor TV is een uitgesproken comedykanaal: een frisse, Nederlandse humorzender met hoogwaardige, grappige, scherpe, jonge, nieuwe, satirische, humoristische programma's."],
  ["NPO Nieuws", "npo_nieuws.png", "LI_NEDERLAND1_221673", "Via het themakanaal 'NPO Nieuws' kunnen de live televisieuitzendingen van het NOS Journaal worden gevolgd. De laatste Journaaluitzending wordt herhaald tot de volgende uitzending van het NOS Journaal."],
  ["NPO Politiek", "npo_politiek.png", "LI_NEDERLAND1_221675", "NPO Politiek is het digitale kanaal over de Nederlandse politiek in de breedste zin van het woord."],
  ["NPO Radio 1", "npo_radio1.png", "LI_RADIO1_300877", "De onafhankelijke nieuws- en sportzender. Als er iets belangrijks gebeurt, in Nederland of in de wereld, luister je NPO Radio 1. Voor de achtergronden en het nieuws van alle kanten. Ook jouw mening telt. Er is veel ruimte voor opinie en debat waar ook luisteraars steevast aan deelnemen."],
  ["NPO Radio 2", "npo_radio2.png", "LI_RADIO2_300879", "Informatie, actualiteit en het beste uit vijftig jaar popmuziek. Een toegankelijke zender met veel aandacht voor het Nederlandse lied, kleinkunst en cabaret."],
  ["NPO 3FM", "npo_3fm.png", "LI_3FM_300881", "Op NPO 3FM staat de liefde voor muziek centraal. Samen met de luisteraar vindt NPO 3FM nieuwe muziek, nieuw Nederlands poptalent en jong radiotalent. Je komt onze dj's vaak tegen op festivals en concerten."],
  ["NPO Radio 4", "npo_radio4.png", "LI_RA4_698901", "De klassieke muziekzender voor zowel de ervaren als de nieuwe liefhebber. Naast de mooiste klassieke muziek, brengt NPO Radio 4 jaarlijks ongeveer twaalfhonderd concerten uit 's werelds beroemdste concertzalen. Waaronder drie eigen concertseries."],
  # ["NPO Radio 5", "npo_radio5.png", "tvlive/mcr1/mcr1.isml/mcr1.m3u8", "Overdag is NPO Radio 5 een sfeervolle zender met vooral evergreens uit de jaren ’60 en ’70. In de avond en het weekeinde brengt NPO Radio 5 beschouwende en informatieve programma’s over: godsdienst, levensbeschouwing en specifieke (sub)culturen."],
  # ["NPO Radio 6", "npo_radio6.png", "visualradio/radio6/radio6.isml/radio6.m3u8", "De Soul & Jazz zender, met muziek van Miles Davis tot Caro Emerald. Onze dj’s en muzikanten nemen je mee op een nationale en internationale ontdekkingstocht. Daarnaast doet NPO Radio 6 jaarlijks verslag van festivals als North Sea Jazz."],
  ["NPO FunX", "npo_funx.png", "LI_3FM_603983", "FunX richt zich op alle jongeren tussen 15 en 35 jaar. Muziekstijlen die op FunX te horen zijn zijn urban, latin, reggae en dancehall, oriental, Turkpop, farsipop, banghra, rai, Frans-Afrikaanse hiphop, Mandopop en andere crossoverstijlen."],
]

EVENTCHANNELS = [

  ["NPO Event 1", "npo_placeholder.png", "tvlive/mcr1/mcr1.isml/mcr1.m3u8", "NPO Evenementkanaal 1."], 
  ["NPO Event 2", "npo_placeholder.png", "tvlive/mcr2/mcr2.isml/mcr2.m3u8", "NPO Evenementkanaal 2."],
  ["NPO Event 3", "npo_placeholder.png", "tvlive/mcr3/mcr3.isml/mcr3.m3u8", "NPO Evenementkanaal 3."],
]

def index():
    for channel in CHANNELS:
        if settings.getSetting(channel[0]) == 'true':
            addLink(channel[0], channel[2], "playVideo", os.path.join(IMG_DIR, channel[1]), channel[3])
        else:
            xbmc.log("plugin.video.nederland24:: %s not set" % str(channel[0]))
    if int(settings.getSetting("Depth_Acht")) != 0:
        url = 'http://feeds.nos.nl/journaal20uur'
        depth = int(settings.getSetting("Depth_Acht"))
        additionalChannels(url, depth)
    if int(settings.getSetting("Depth_Jeugd")) != 0:
        url = 'http://feeds.nos.nl/vodcast_jeugdjournaal'
        depth = int(settings.getSetting("Depth_Jeugd"))
        additionalChannels(url, depth)
    if settings.getSetting("EVENT") == 'true':
        for channel in EVENTCHANNELS:
            # if settings.getSetting(channel[0]) == 'true':
                addLink(channel[0], channel[2], "playVideo", os.path.join(IMG_DIR, channel[1]), channel[3])
            # else:
                # xbmc.log("plugin.video.nederland24:: %s not set" % str(channel[0]))
    else:
        xbmc.log("plugin.video.nederland24:: No additional channels set")
    xbmcplugin.endOfDirectory(pluginhandle)

def prefer_clca():
    if settings.getSetting("CLCA") == 'true':
        for channel in CHANNELS:
            if channel[0] == "NPO 1":
                channel[2] = "tvlive/npo1cc/npo1cc.isml/npo1cc.m3u8"
            elif channel[0] == "NPO 2":
                channel[2] = "tvlive/npo2cc/npo2cc.isml/npo2cc.m3u8"
            elif channel[0] == "NPO 3":
                channel[2] = "tvlive/npo3cc/npo3cc.isml/npo3cc.m3u8"

def resolve_http_redirect(url, depth=0):
    if depth > 10:
        raise Exception("Redirected "+depth+" times, giving up.")
    o = urlparse.urlparse(url, allow_fragments=True)
    conn = httplib.HTTPConnection(o.netloc)
    path = o.path
    if o.query:
        path += '?'+o.query
    conn.request("HEAD", path)
    res = conn.getresponse()
    headers = dict(res.getheaders())
    if headers.has_key('location') and headers['location'] != url:
        return resolve_http_redirect(headers['location'], depth+1)
    else:
        return url

def extract_url(chan):
    URL = API_URL+BASE_URL+(chan)
    req = urllib2.Request(URL)
    req.add_header('User-Agent', USER_AGENT)
    response = urllib2.urlopen(req)
    page = response.read()
    response.close()
    videopre = re.search(r'http:(.*?)url', page).group()
    prostream = (videopre.replace('\/', '/'))
    video = resolve_http_redirect(prostream, 3)
    return video

def collect_token():
    req = urllib2.Request(TOKEN_URL)
    req.add_header('User-Agent', USER_AGENT)
    response = urllib2.urlopen(req)
    page = response.read()
    response.close()
    token = re.search(r'token\":"(.*?)"', page).group(1)
    xbmc.log("plugin.video.nederland24:: token: %s" % token)
    return token

def addLink(name, url, mode, iconimage, description):
    u = sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+urllib.quote_plus(mode)
    ok = True
    liz = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
    liz.setInfo(type="Video", infoLabels={"Title": name,
                                          "Plot":description,
                                          "TVShowTitle":name,
                                          "Playcount": 0,
                                          })

    liz.setProperty("fanart_image", os.path.join(IMG_DIR, "fanart.png"))
    liz.setProperty('IsPlayable', 'true')
    ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz)
    return ok

def additionalChannels(url, depth):
    i = 0
    URL = url
    # URL = 'http://feeds.nos.nl/journaal'
    items = SoupStrainer('item')
    for tag in BeautifulStoneSoup(urllib2.urlopen(URL).read(), parseOnlyThese=items):
        title = tag.title.contents[0]
        url = tag.guid.contents[0]
        img = os.path.join(IMG_DIR, "npo_placeholder.png")
        addLink(title, url, "playVideo", img, '')
        i += 1
        if i == int(depth):
            break

def playVideo(url):
    media = url
    finalUrl = ""
    if media and media.startswith("http://") or media.startswith("https://"):
        finalUrl = media
    else:
        URL = API_URL+media+"?adaptive=yes&token=%s" % collect_token()
        xbmc.log("plugin.video.nederland24:: URL and token %s" % str(URL))
        req = urllib2.Request(URL)
        req.add_header('User-Agent', USER_AGENT)
        req.add_header('Referer', REF_URL)
        req.add_header('HTTP_NPOPLAYER_VERSION', '7.2.4')
        response = urllib2.urlopen(req)
        page = response.read()
        response.close()
        videopre = re.search(r'http:(.*?)url', page).group()
        prostream = (videopre.replace('\/', '/'))
    intermediateURL=resolve_http_redirect(prostream)
    xbmc.log("plugin.video.nederland24:: intermediate URL %s" % str(intermediateURL))
    req = urllib2.Request(intermediateURL)
        req.add_header('User-Agent', USER_AGENT)
        req.add_header('Referer', REF_URL)
        req.add_header('HTTP_NPOPLAYER_VERSION', '7.2.4')
        response = urllib2.urlopen(req)
        page = response.read()
    xbmc.log("plugin.video.nederland24:: Videopage %s" % str(page))
        response.close()
        videopre = re.search(r'http:(.*?)m3u8', page).group()
        prostream = (videopre.replace('\/', '/'))
    xbmc.log("plugin.video.nederland24:: final URL %s" % str(prostream))    

        finalUrl = resolve_http_redirect(prostream)
    if finalUrl:
        listitem = xbmcgui.ListItem(path=finalUrl)
        xbmcplugin.setResolvedUrl(pluginhandle, True, listitem)

def parameters_string_to_dict(parameters):
    paramDict = {}
    if parameters:
        paramPairs = parameters[1:].split("&")
        for paramsPair in paramPairs:
            paramSplits = paramsPair.split('=')
            if (len(paramSplits)) == 2:
                paramDict[paramSplits[0]] = paramSplits[1]
    return paramDict

params = parameters_string_to_dict(sys.argv[2])
mode = urllib.unquote_plus(params.get('mode', ''))
url = urllib.unquote_plus(params.get('url', ''))
prefer_clca()

if mode == "playVideo":
    playVideo(url)
else:
    index()

I don't know how fixed the strings LI_NL1_4188102 etc are.

sciurius commented 7 years ago

Thanks, unfortunately markup screwed it... Can you attach the file to a comment?

mrarends commented 7 years ago

I just fixed the markup

sciurius commented 7 years ago

??? Please attach the file to a comment.

mrarends commented 7 years ago

Uploading gives: Something went really wrong, and we can’t process that file. (just a .txt file).

Can you not see the code in my comment?

sciurius commented 7 years ago

I can see the code but it is screwed up since github interprets it as being markdown. The (python-essential) structure is lost. Can you mail a copy to squirrel at xs4all.nl ?

mrarends commented 7 years ago

25 Hope this works, otherwise I will mail :)

sciurius commented 7 years ago

Yes, this works! Thanks!

sciurius commented 7 years ago

Hmm. I still get errors:

20:21:46.962 T:139658762406336 ERROR: CCurlFile::Stat - Failed: HTTP response code said error(22) for http://pedgewarea23a.video.kpnstreaming.nl:80/session/256c06e6-fdeb-11e6-8fdd-9cb65498b840/fqimjj/b2b/live/npo/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8

mrarends commented 7 years ago

mmm strange. Here is my log

19:06:22.614 T:139855112054528   DEBUG: plugin.video.nederland24:: token: 2luvdllqi5pdthaq0kcb3tvm86
19:06:22.614 T:139855112054528   DEBUG: plugin.video.nederland24:: URL and token http://ida.omroep.nl/app.php/LI_NL1_4188102?adaptive=yes&token=2luvdllqi5pdthaq0kcb3tvm86
19:06:22.958 T:139855112054528   DEBUG: plugin.video.nederland24:: intermediate URL http://livestreams.omroep.nl/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8?hash=54423fa8709cc5c854a4a0e08ce1693a&type=jsonp&protection=url
19:06:23.013 T:139855112054528   DEBUG: plugin.video.nederland24:: Videopage setSource("http:\/\/l2cmaf21d09c910058b5bbc4000000.841e4293b325e484.smoote2i.npostreaming.nl\/d\/live\/npo\/tvlive\/npo1\/npo1.isml\/npo1.m3u8")
19:06:23.013 T:139855112054528   DEBUG: plugin.video.nederland24:: final URL http://l2cmaf21d09c910058b5bbc4000000.841e4293b325e484.smoote2i.npostreaming.nl/d/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8
19:06:23.063 T:139855112054528    INFO: CPythonInvoker(103, /home/mark/.kodi/addons/plugin.video.nederland24/nederland24.py): script successfully run
19:06:23.074 T:139856583833344   DEBUG: Thread scriptobs 139856583833344 terminating
19:06:23.074 T:139858469636096    INFO: easy_acquire - Created session to http://l2cmaf21d09c910058b5bbc4000000.841e4293b325e484.smoote2i.npostreaming.nl
19:06:23.095 T:139855112054528    INFO: Python script stopped
19:06:23.095 T:139855112054528   DEBUG: Thread LanguageInvoker 139855112054528 terminating
19:06:23.133 T:139858469636096   DEBUG: CCurlFile::GetMimeType - http://l2cmaf21d09c910058b5bbc4000000.841e4293b325e484.smoote2i.npostreaming.nl/d/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8 -> application/vnd.apple.mpegurl
19:06:23.136 T:139858469636096   DEBUG: Loading settings for http://l2cmaf21d09c910058b5bbc4000000.841e4293b325e484.smoote2i.npostreaming.nl/d/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8
19:06:23.137 T:139858469636096   DEBUG: CPlayerCoreFactory::GetPlayers(http://l2cmaf21d09c910058b5bbc4000000.841e4293b325e484.smoote2i.npostreaming.nl/d/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8)
sciurius commented 7 years ago

20:36:46.423 T:139657622836992 DEBUG: plugin.video.nederland24:: Starting Addon 20:36:46.460 T:139657622836992 DEBUG: plugin.video.nederland24:: token: 1j84n7oflv37bqat15t3dn7ii6 20:36:46.460 T:139657622836992 DEBUG: plugin.video.nederland24:: URL and token http://ida.omroep.nl/app.php/LI_NL1_4188102?adaptive=yes&token=1j84n7oflv37bqat15t3dn7ii6 20:36:46.602 T:139657622836992 DEBUG: plugin.video.nederland24:: intermediate URL http://livestreams.omroep.nl/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8?hash=bce1a63716137043d19a0e5f7293cfa7&type=jsonp&protection=url 20:36:46.674 T:139657622836992 DEBUG: plugin.video.nederland24:: Videopage setSource("http:\/\/pedgewarea27b.video.kpnstreaming.nl:80\/session\/3dc29d02-fded-11e6-ad95-9cb65498b840\/fqimjj\/b2b\/live\/npo\/live\/npo\/tvlive\/npo1\/npo1.isml\/npo1.m3u8?token=2db03f568c11087f197167ae906aa2fd_1488397006_1488397006") 20:36:46.674 T:139657622836992 DEBUG: plugin.video.nederland24:: final URL http://pedgewarea27b.video.kpnstreaming.nl:80/session/3dc29d02-fded-11e6-ad95-9cb65498b840/fqimjj/b2b/live/npo/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8 20:36:46.720 T:139657622836992 INFO: CPythonInvoker(10, /home/jv/.kodi/addons/plugin.video.nederland24/nederland24.py): script successfully run 20:36:46.738 T:139657639622400 DEBUG: Thread scriptobs 139657639622400 terminating 20:36:46.739 T:139658762406336 INFO: easy_aquire - Created session to http://pedgewarea27b.video.kpnstreaming.nl 20:36:46.741 T:139657622836992 INFO: Python script stopped 20:36:46.741 T:139657622836992 DEBUG: Thread LanguageInvoker 139657622836992 terminating 20:36:46.801 T:139658762406336 ERROR: CCurlFile::Stat - Failed: HTTP response code said error(22) for http://pedgewarea27b.video.kpnstreaming.nl:80/session/3dc29d02-fded-11e6-ad95-9cb65498b840/fqimjj/b2b/live/npo/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8 20:36:46.801 T:139658762406336 DEBUG: CCurlFile::GetMimeType - http://pedgewarea27b.video.kpnstreaming.nl:80/session/3dc29d02-fded-11e6-ad95-9cb65498b840/fqimjj/b2b/live/npo/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8 -> failed

mrarends commented 7 years ago

Is NPO working normally in your browser? I'm not customer of KPN so I'm not redirected to kpnstreaming.nl.

marcknijn commented 7 years ago

hi mrarends, I think I have the same issue as sciurius. I'm on a Telfort connection, but NPO works fine in my browser. Any idea's?

21:25:53 T:804401152 INFO: CPythonInvoker(4, /var/mobile/Library/Preferences/Kodi/addons/plugin.video.nederland24-a2ab43c5b821800fad73e3577087a9bfbfa3bd15/nederland24.py): script successfully run 21:25:53 T:804401152 INFO: Python script stopped 21:25:53 T:804401152 DEBUG: Thread LanguageInvoker 0 terminating 21:25:53 T:145780736 DEBUG: DoWork - took 2945 ms to load special://masterprofile/Thumbnails/7/7c60ff7c.png 21:25:53 T:39915520 DEBUG: WaitOnScriptResult- plugin returned successfully 21:25:53 T:39915520 INFO: easy_aquire - Created session to http://pedgewarer29b.video.kpnstreaming.nl 21:25:53 T:39915520 ERROR: CCurlFile::Stat - Failed: HTTP response code said error(22) for http://pedgewarer29b.video.kpnstreaming.nl:80/session/1a20153a-fdf4-11e6-9856-9cb65498e820/fqimjj/b2b/live/npo/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8 21:25:53 T:39915520 DEBUG: CCurlFile::GetMimeType - http://pedgewarer29b.video.kpnstreaming.nl:80/session/1a20153a-fdf4-11e6-9856-9cb65498e820/fqimjj/b2b/live/npo/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8 -> failed 21:25:53 T:39915520 DEBUG: Loading settings for http://pedgewarer29b.video.kpnstreaming.nl:80/session/1a20153a-fdf4-11e6-9856-9cb65498e820/fqimjj/b2b/live/npo/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8 21:25:53 T:39915520 DEBUG: CPlayerCoreFactory::GetPlayers(http://pedgewarer29b.video.kpnstreaming.nl:80/session/1a20153a-fdf4-11e6-9856-9cb65498e820/fqimjj/b2b/live/npo/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8) 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: system rules 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: matches rule: system rules 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtv 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: hdhomerun/myth/mms/udp 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: lastfm/shout 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtmp 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtsp 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: streams 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: matches rule: streams 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: aacp/sdp 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: mp2 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: dvd 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: dvdimage 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: sdp/asf 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: nsv 21:25:53 T:39915520 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: radio 21:25:53 T:39915520 DEBUG: CPlayerCoreFactory::GetPlayers: matched 0 rules with players 21:25:53 T:39915520 DEBUG: CPlayerCoreFactory::GetPlayers: adding videodefaultplayer (1) 21:25:53 T:39915520 DEBUG: CPlayerCoreFactory::GetPlayers: for video=1, audio=0 21:25:53 T:39915520 DEBUG: CPlayerCoreFactory::GetPlayers: for video=1, audio=1 21:25:53 T:39915520 DEBUG: CPlayerCoreFactory::GetPlayers: adding player: DVDPlayer (1) 21:25:53 T:39915520 DEBUG: CPlayerCoreFactory::GetPlayers: added 1 players 21:25:53 T:39915520 NOTICE: DVDPlayer: Opening: http://pedgewarer29b.video.kpnstreaming.nl:80/session/1a20153a-fdf4-11e6-9856-9cb65498e820/fqimjj/b2b/live/npo/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8 21:25:53 T:39915520 WARNING: CDVDMessageQueue(player)::Put MSGQ_NOT_INITIALIZED 21:25:53 T:39915520 DEBUG: CRenderManager::UpdateDisplayLatency - Latency set to 0 msec 21:25:53 T:39915520 DEBUG: LinuxRendererGL: Cleaning up GL resources 21:25:53 T:804401152 NOTICE: Thread DVDPlayer start, auto delete: false 21:25:53 T:804401152 NOTICE: Creating InputStream 21:25:53 T:804401152 DEBUG: CFileCache::Open - opening <session/1a20153a-fdf4-11e6-9856-9cb65498e820/fqimjj/b2b/live/npo/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8> using cache 21:25:53 T:804401152 DEBUG: CurlFile::Open(0x20e1bdf0) http://pedgewarer29b.video.kpnstreaming.nl:80/session/1a20153a-fdf4-11e6-9856-9cb65498e820/fqimjj/b2b/live/npo/live/npo/tvlive/npo1/npo1.isml/npo1.m3u8 21:25:53 T:804401152 ERROR: CCurlFile::FillBuffer - Failed: HTTP returned error 403

mrarends commented 7 years ago

The changes I've made seems to work correctly. The addon is first retrieving a token and then it retrieves the url of the m3u8 playlist. But the download of this file is not successful.

Since Telfort is a doughter company of KPN it is also using kpnstreaming. Maybe for KPN we have to do something special?

Can you record a HAR file from viewing NPO in a browser?: https://toolbox.googleapps.com/apps/har_analyzer/ and post it?

I have also just fixed the 'Uitzending gemist': https://github.com/Opvolger/plugin.video.uzg/pull/5 Is this also not working?

sciurius commented 7 years ago

I'm connected via XS4All. HAR at http://www.squirrel.nl/pub/xfer/uploads/3CeE_MxxphWoyIdUhGsq8wcw.har.gz

rwielinga commented 7 years ago

Thanks for your efforts guys, i also have this issue. Watching this topic for a resolution.

joosth9n commented 7 years ago

I temporarily "fixed" it by creating a VPN connection on the Kodi box to circumvent this "kpnstreaming redirect" thing. :-P

mrarends commented 7 years ago

Ok thanks for the extra information. It seems the kpnstreaming is working a bit different. I will study the HAR file to find a difference.

marcknijn commented 7 years ago

Thanks mrarends!

mrarends commented 7 years ago

In #25 I have committed a new version which hopefully also works with KPN.

bosel commented 7 years ago

Thank guys. Add-on should update fairly soon through Kodi. If you cannot wait, please download from here and place in your addon folder.