Commit 6a3c4f52 by Markus Koschany

Remove obsolete picn URLs. Apparently they provide a filmlist which is not

compatible with our current mediathek.py script.
parent 9d739684
......@@ -4,7 +4,7 @@
MediathekDirekt - Serverskript
Copyright 2014, martin776
Copyright 2014-2017, Markus Koschany
Copyright 2014, Markus Koschany
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -32,6 +32,7 @@ import logging
import random
from urllib.request import urlopen, urlretrieve
import urllib.error
from xml.dom import minidom
from datetime import datetime, timedelta
import lzma
......@@ -47,6 +48,7 @@ except OSError:
#Paths
LOG_FILENAME = 'mediathek.log'
URL_SOURCE = 'http://zdfmediathk.sourceforge.net/update-json.xml'
#Settings:
......@@ -65,14 +67,22 @@ logger.info("***")
logger.info(str(datetime.now()))
logger.info("MediathekDirekt: Starting download")
#Download list of filmservers and extract the URLs of the filmlists
try:
server_list = urlopen(URL_SOURCE)
except urllib.error.URLError as e:
logger.error(e.reason)
#xmldoc = minidom.parse(server_list)
#itemlist = xmldoc.getElementsByTagName('URL')
itemlist = [
'http://verteiler3.mediathekview.de/Filmliste-akt.xz',
'http://verteiler2.mediathekview.de/Filmliste-akt.xz',
'http://verteiler1.mediathekview.de/Filmliste-akt.xz',
'http://download10.onlinetvrecorder.com/mediathekview/Filmliste-akt.xz',
'http://m1.picn.de/f/Filmliste-akt.xz',
'http://m2.picn.de/f/Filmliste-akt.xz',
'http://m.picn.de/f/Filmliste-akt.xz'
'http://verteiler4.mediathekview.de/Filmliste-akt.xz',
'http://verteiler5.mediathekview.de/Filmliste-akt.xz',
'http://verteiler6.mediathekview.de/Filmliste-akt.xz'
]
......@@ -80,13 +90,12 @@ itemlist = [
#Reverse order to download the latest list first
for url in itemlist[::-1]:
try:
#url = item.firstChild.nodeValue
response = urlopen(url)
html = response.read()
logger.info("Downloaded {} bytes from {}.".format(len(html), url))
data = lzma.decompress(html)
logger.info("Extracted {} bytes" .format(len(data)))
# Convert broken upstream filmlist (invalid JSON) into a more readable format which is
# also easier to parse
if data:
with open('full.json', mode='wb') as fout:
fout.write(data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment