Fixed some issues with movie EAN detection

This commit is contained in:
2021-04-18 15:02:48 +02:00
parent 3c58697163
commit 647301068f
2 changed files with 37 additions and 4 deletions

View File

@@ -22,8 +22,11 @@ class MyServer(BaseHTTPRequestHandler):
try:
tme = tme.split('<div data-nx-container="inread"><!-- INREAD --></div>')[1]
tme = tme.split('img src="https://ssl.ofdb.de/images/shim.gif" width="1" height="10" border="0" alt=""></td>')[0]
tme = tme.split(',SHADOW,true)"><b>')[1]
tme = tme.split('</b></a><br>')[0]
tme = tme.split('<i>Vorab-Eintr&auml;ge:</i>')[1]
tme = tme.split(",SHADOW,true)\"><b>")[1]
tme = tme.split("</b></a><br>")[0]
print(tme)
#tme = tme.split('</b></a><br>')[0]
tme = tme[:len(tme)-7]
except IndexError:
self.send_response(500)
@@ -35,6 +38,34 @@ class MyServer(BaseHTTPRequestHandler):
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write(bytes(tme, "utf-8"))
elif(self.path.startswith("/?eanMulti=")):
print("EAN request")
eanCode = self.path.split("=")[1]
print(eanCode)
url = 'https://ssl.ofdb.de/view.php?page=suchergebnis'
myobj = {'SText': eanCode, 'Kat':'EAN'} #'4030521376748'
x = requests.post(url, data = myobj)
tme = x.text
try:
tme = tme.split('<div data-nx-container="inread"><!-- INREAD --></div>')[1]
tme = tme.split('img src="https://ssl.ofdb.de/images/shim.gif" width="1" height="10" border="0" alt=""></td>')[0]
#tme = tme.split('width=&quot;120&quot; height=&quot;168&quot;>\',SHADOW,true)"><b>')[1]
print(tme)
#tme = tme.split(',SHADOW,true)"><b>')[1]
#tme = tme.split('</b></a><br>')[0]
#tme = tme[:len(tme)-7]
except IndexError:
self.send_response(500)
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write(bytes("Invalid EAN", "utf-8"))
else:
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write(bytes(tme, "utf-8"))
else:
self.send_response(404)
self.send_header("Content-type", "text/html")