Exaphis / HackQ-Trivia

Yet another HQ Trivia bot. Automatically scrapes HQ Trivia questions without OCR and answers them.
MIT License
89 stars 54 forks source link

Getting 0 results #112

Closed dxrk closed 5 years ago

dxrk commented 6 years ago

Recently I have realized that I am not getting any results (no keywords or noun results). I think it might have something to do with the google search API, but don't know how to make it work again. Any tips or any solutions anyone has would be great! From command prompt- https://darktv.xyz/i/VKCHP No results.txt

Exaphis commented 6 years ago

Could you post your log file here? It may be because you don't have a fast enough internet connection.

dxrk commented 6 years ago

Ive been using the bot for 1-2 months now flawlessly, updating the files whenever necessary and even changing the bearer and ID. I'd like to give this information, but I don't see a log file

Exaphis commented 6 years ago

The log file would be the data.log inside your HackQ-Trivia folder.

dxrk commented 6 years ago

data.log

mystaroll commented 6 years ago

Same here, 0 results on everything

Exaphis commented 6 years ago

@mustafahafidi Could you post your log file as well? Does this happen every single time you run the program? Has this happened consistently since your installation? Does this happen on another network/another computer?

mystaroll commented 6 years ago

This is a problem related with the google search, I mocked the wss server and I can see that search_results = await search.search_google("+".join(question_keywords), 5) returns an empty list

datamocked.log dataoriginal.log

mystaroll commented 6 years ago

Update: It's related to the \x escape sequence (which explains why we get inappropriate results from the google search), cleaning it correctly solves the issue. @Exaphis

dxrk commented 6 years ago

@mustafahafidi could you send me the file with the fix?

mystaroll commented 6 years ago

In file networking.py look for the line message = re.sub(r"[\x00-\x1f\x7f-\x9f]", "", message) and add right after it: message = re.sub(r"\\x..", "", str(message.encode("utf-8"))[2:-1]) message = re.sub(r"\\", "", str(message.encode("utf-8"))[2:-1]) not clean but it works, let me know

Jasperaj commented 5 years ago

In file networking.py look for the line message = re.sub(r"[\x00-\x1f\x7f-\x9f]", "", message) and add right after it: message = re.sub(r"\\x..", "", str(message.encode("utf-8"))[2:-1]) message = re.sub(r"\\", "", str(message.encode("utf-8"))[2:-1]) not clean but it works, let me know

@mustafahafidi Adding also gave 0 results. Any other option?