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")

View File

@ -181,9 +181,11 @@
curEan = document.getElementById("currentEAN").innerHTML
curEan = curEan.replace("EAN: ", "")
document.getElementById("mainCont").innerHTML = "<h4>OpenMovieDB - Add a new movie</h4><center><div class=\"lds-grid\"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div><br><i>Searching database...</i></center>";
if(curEan[0] == "0"){
/*if(curEan[0] == "0"){
curEan = curEan.substring(1);
}
}*/
curEan = String(curEan-0)
console.warn(curEan)
url = "/apiCallBack?ean=" + curEan;
//window.open(url)
$.get(url,function(data,status) {