evilhero / mylar

An automated Comic Book downloader (cbr/cbz) for use with SABnzbd, NZBGet and torrents
GNU General Public License v3.0
976 stars 172 forks source link

. 500 error when searching Master of Kung Fu #1767

Closed tcn33 closed 3 years ago

tcn33 commented 6 years ago

Getting this error when trying to add Master of Kung Fu from the weekly pull list.

Mylar Version: development git build a226658876af19d60d3c4291ea158644731f143b Python Version : 2.7.12 alt_pull 2

  File "/opt/mylar/lib/cherrypy/_cprequest.py", line 645, in respond
    response.body = self.handler()
  File "/opt/mylar/lib/cherrypy/lib/encoding.py", line 188, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/opt/mylar/lib/cherrypy/_cpdispatch.py", line 29, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/opt/mylar/mylar/webserve.py", line 230, in searchit
    searchresults, explicit = mb.findComic(name, mode, issue=issue)
  File "/opt/mylar/mylar/mb.py", line 156, in findComic
    searched = pullsearch(comicapi, comicquery, offsetcount, explicit, type)
  File "/opt/mylar/mylar/mb.py", line 78, in pullsearch
    dom = parseString(r.content) #(data)
  File "/usr/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
    return expatbuilder.parseString(string)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
    return builder.parseString(string)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
    parser.Parse(string, True)
ExpatError: syntax error: line 1, column 0

Getting the same error when searching for Ms Marvel. Other series come up normally though.

evilhero commented 6 years ago

Usually that means that CV is returning non-xml, which usually is due to an invalid comicvine apikey.

Can you confirm that your apikey is correct and that you haven't gone over the api limit? You can check your limit by going to the comicvine.gamespot.com/api url and signing in. They limit it based on seconds per request as well as per hour, so it's possible you just got temporarily hit by a temp ban or something.

Telecart commented 6 years ago

getting the same issue I think when searching for "Black Crown", but not when searching for "White Knight".

500 Internal Server Error

The server encountered an unexpected condition which prevented it from fulfilling the request.

Traceback (most recent call last):
  File "/Applications/Mylar/lib/cherrypy/_cprequest.py", line 645, in respond
    response.body = self.handler()
  File "/Applications/Mylar/lib/cherrypy/lib/encoding.py", line 188, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/Applications/Mylar/lib/cherrypy/_cpdispatch.py", line 29, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/Applications/Mylar/mylar/webserve.py", line 242, in searchit
    searchresults, explicit = mb.findComic(name, mode, issue=None, explicit=explicit)
  File "/Applications/Mylar/mylar/mb.py", line 156, in findComic
    searched = pullsearch(comicapi, comicquery, offsetcount, explicit, type)
  File "/Applications/Mylar/mylar/mb.py", line 78, in pullsearch
    dom = parseString(r.content) #(data)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
    return expatbuilder.parseString(string)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
    return builder.parseString(string)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
    parser.Parse(string, True)
ExpatError: syntax error: line 1, column 0
tcn33 commented 6 years ago

@evilhero confirmed my API key is correct and not rate limited.

evilhero commented 6 years ago

There's something going on with CV.. I'm getting that error now when searching for it as well via the pull.

But at least if I can replicate it, I can fix it ;)

Thanks for the patience on this with it being Wednesday pull too. I'll try and hammer out something shortly if I can figure out the problem...

evilhero commented 6 years ago

Ok, after working on this for abit (and falling asleep, then waking up and doing it again...), I figured this out. It turns out that because the current iteration of Mylar uses an old search function that really sucks when searching for terms, and in this case it was trying to search for every occurrence of 'Master', 'of', and 'kung-fu'..which came back with something like 13000+ hits and it was just timing out.

So I ripped apart the search, redid it so it can query directly against the specific term and the results are actually pretty good now. It will only return relevant information to the term(s), instead of every iteration - which means that retrieving 1000 results from CV (the max that Mylar will retrieve just because more than that is kinda insane, and even 1000 is probably too much) takes a little over 30s now.

This fix will be going into config-upgrade branch atm, just because of how things are intertwined and how involved the changes are and going backwards isn't an option. So it will be a couple more days before things hit the development branch, but when config-upgrade merges there will be a bunch of new things that should make life easier for alot of people going forward ;)

As an aside, if you're currently getting this error and you're up-to-date on the dev/master branch, the workaround is to use the search bar at the top of each page and enclose your search term in double quotes (ie. "master of kung fu"). That will make Mylar match specific terms and you'll get the results you want - however it will match exactly so if the series isn't exactly named as per CV it won't find a match. This is of course just until the branches merge,

evilhero commented 6 years ago

Fix is now in development - note that there are some specific search terms that are causing CV problems atm, and that's a noted CV problem (you can see #1773 for more information about the current problems). When they're fixed on CV's side, Mylar will be able to search those terms as per normal.