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

Highlight answers and more errors #23

Closed chaoscreater closed 6 years ago

chaoscreater commented 6 years ago

It's hard to find the answer in the result below. Could you perhaps update the script to highlight the answer or show it in a different colour?

`Question detected. Question 9 out of 12 The fashion brand Opening Ceremony once put on a play co-written by what actor? ['Jonah Hill', 'Chloë Sevigny', 'Jesse Eisenberg']

Searching ['Jonah Hill', 'Chloe Sevigny', 'Jesse Eisenberg'] ['fashion', 'brand', 'opening', 'ceremony', 'put', 'play', 'co', 'written', 'actor'] ['https://www.vanityfair.com/style/2014/09/opening-ceremony-new-york-fashion-week-jonah-hill', 'http://www.dazeddigital.com/fashion/article/21578/1/read-an-exclusive-interview-with-jonah-hill-and-spike-jonze', 'http://www.dazeddigital.com/fashion/article/21259/1/spike-jonze-is-staging-a-play-for-opening-ceremony-ss15', 'http://creativity-online.com/work/opening-ceremonyspike-jonze-100-lost-cotton/37077', 'https://en.wikipedia.org/wiki/Opening_Ceremony_(brand)'] Running method 1 {'jonah hill': 39, 'chloe sevigny': 1, 'jesse eisenberg': 0} jonah hill

[('The', 'DT'), ('fashion', 'NN'), ('brand', 'NN'), ('Opening', 'NNP'), ('Ceremony', 'NNP'), ('once', 'RB'), ('put', 'VBD'), ('on', 'IN'), ('a', 'DT'), ('play', 'NN'), ('co-written', 'JJ'), ('by', 'IN'), ('what', 'WP'), ('actor', 'NN'), ('?', '.')] Question nouns: ['fashion brand opening ceremony'] Running method 3 Search processed URLs fetched

Jonah Hill: {'fashion brand opening ceremony': 0} Chloë Sevigny: {'fashion brand opening ceremony': 0} Jesse Eisenberg: {'fashion brand opening ceremony': 0}

Keyword scores: {'Jonah Hill': 48, 'Chloë Sevigny': 68, 'Jesse Eisenberg': 83} Noun scores: {'Jonah Hill': 0, 'Chloë Sevigny': 0, 'Jesse Eisenberg': 0} Jonah Hill Search took 7.578475713729858 seconds

Socket closed

Show active, connecting to socket at https://ws-quiz.hype.space/ws/44181 Connected`

Also, I'm still getting errors every now and then and I'm already using the latest version.

`Question detected. Question 10 out of 12 Which of these products was originally developed for surgical use? ['Listerine', 'Bengay', 'VapoRub']

Searching ['Listerine', 'Bengay', 'VapoRub'] ['products', 'originally', 'developed', 'surgical', 'use'] ['http://mentalfloss.com/article/29840/6-hugely-successful-products-originally-invented-something-else', 'https://en.wikipedia.org/wiki/Surgical_instrument', 'https://en.wikipedia.org/wiki/Joseph_Lister', 'https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1356187/', 'https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1121442/'] Server timeout/error to http://mentalfloss.com/article/29840/6-hugely-successful-products-originally-invented-something-else --- Logging error --- Traceback (most recent call last): File "W:\HQ Trivia\HackQ-Trivia\networking.py", line 13, in fetch async with session.get(url, timeout=timeout) as response: File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 782, in aenter self._resp = await self._coro File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 407, in _request break File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\helpers.py", line 661, in exit raise asyncio.TimeoutError from None concurrent.futures._base.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging__init.py", line 992, in emit msg = self.format(record) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging__init.py", line 838, in format return fmt.format(record) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging\init.py", line 575, in format record.message = record.getMessage() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging\init.py", line 338, in getMessage msg = msg % self.args TypeError: not all arguments converted during string formatting Call stack: File "", line 1, in File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\idlelib\run.py", line 144, in main ret = method(*args, *kwargs) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\idlelib\run.py", line 474, in runcode exec(code, self.locals) File "W:\HQ Trivia\HackQ-Trivia\hq_main.py", line 47, in asyncio.get_event_loop().run_until_complete(networking.websocket_handler(socket, headers)) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 454, in run_until_complete self.run_forever() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 421, in run_forever self._run_once() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 1431, in _run_once handle._run() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\events.py", line 145, in _run self._callback(self._args) File "W:\HQ Trivia\HackQ-Trivia\networking.py", line 17, in fetch logging.error(type(e), e) Message: <class 'concurrent.futures._base.TimeoutError'> Arguments: (TimeoutError(),) Server timeout/error to https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1121442/ --- Logging error --- Traceback (most recent call last): File "W:\HQ Trivia\HackQ-Trivia\networking.py", line 13, in fetch async with session.get(url, timeout=timeout) as response: File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 782, in aenter__ self._resp = await self._coro File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 332, in _request await resp.start(conn, read_until_eof) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client_reqrep.py", line 691, in start self._continue = None File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\helpers.py", line 661, in exit__ raise asyncio.TimeoutError from None concurrent.futures._base.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging__init.py", line 992, in emit msg = self.format(record) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging__init.py", line 838, in format return fmt.format(record) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging\init.py", line 575, in format record.message = record.getMessage() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging\init.py", line 338, in getMessage msg = msg % self.args TypeError: not all arguments converted during string formatting Call stack: File "", line 1, in File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\idlelib\run.py", line 144, in main ret = method(*args, *kwargs) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\idlelib\run.py", line 474, in runcode exec(code, self.locals) File "W:\HQ Trivia\HackQ-Trivia\hq_main.py", line 47, in asyncio.get_event_loop().run_until_complete(networking.websocket_handler(socket, headers)) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 454, in run_until_complete self.run_forever() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 421, in run_forever self._run_once() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 1431, in _run_once handle._run() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\events.py", line 145, in _run self._callback(self._args) File "W:\HQ Trivia\HackQ-Trivia\networking.py", line 17, in fetch logging.error(type(e), e) Message: <class 'concurrent.futures._base.TimeoutError'> Arguments: (TimeoutError(),) Server timeout/error to https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1356187/ --- Logging error --- Traceback (most recent call last): File "W:\HQ Trivia\HackQ-Trivia\networking.py", line 13, in fetch async with session.get(url, timeout=timeout) as response: File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 782, in aenter__ self._resp = await self._coro File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 332, in _request await resp.start(conn, read_until_eof) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client_reqrep.py", line 691, in start self._continue = None File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\helpers.py", line 661, in exit__ raise asyncio.TimeoutError from None concurrent.futures._base.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging__init.py", line 992, in emit msg = self.format(record) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging\init.py", line 838, in format return fmt.format(record) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging\init.py", line 575, in format record.message = record.getMessage() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging\init__.py", line 338, in getMessage msg = msg % self.args TypeError: not all arguments converted during string formatting Call stack: File "", line 1, in File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\idlelib\run.py", line 144, in main ret = method(*args, *kwargs) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\idlelib\run.py", line 474, in runcode exec(code, self.locals) File "W:\HQ Trivia\HackQ-Trivia\hq_main.py", line 47, in asyncio.get_event_loop().run_until_complete(networking.websocket_handler(socket, headers)) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 454, in run_until_complete self.run_forever() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 421, in run_forever self._run_once() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 1431, in _run_once handle._run() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\events.py", line 145, in _run self._callback(self._args) File "W:\HQ Trivia\HackQ-Trivia\networking.py", line 17, in fetch logging.error(type(e), e) Message: <class 'concurrent.futures._base.TimeoutError'> Arguments: (TimeoutError(),) Running method 1 {'listerine': 2, 'bengay': 0, 'vaporub': 0} listerine

[('Which', 'NNP'), ('of', 'IN'), ('these', 'DT'), ('products', 'NNS'), ('was', 'VBD'), ('originally', 'RB'), ('developed', 'VBN'), ('for', 'IN'), ('surgical', 'JJ'), ('use', 'NN'), ('?', '.')] Question nouns: ['use'] Running method 3 Search processed Server timeout/error to https://www.more.com/lifestyle/exercise-health/12-surprising-uses-vicks-vaporub --- Logging error --- Traceback (most recent call last): File "W:\HQ Trivia\HackQ-Trivia\networking.py", line 13, in fetch async with session.get(url, timeout=timeout) as response: File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 782, in aenter self._resp = await self._coro File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 332, in _request await resp.start(conn, read_until_eof) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client_reqrep.py", line 691, in start self._continue = None File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\helpers.py", line 661, in exit raise asyncio.TimeoutError from None concurrent.futures._base.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging__init.py", line 992, in emit msg = self.format(record) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging__init.py", line 838, in format return fmt.format(record) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging\init.py", line 575, in format record.message = record.getMessage() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging\init.py", line 338, in getMessage msg = msg % self.args TypeError: not all arguments converted during string formatting Call stack: File "", line 1, in File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\idlelib\run.py", line 144, in main ret = method(*args, *kwargs) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\idlelib\run.py", line 474, in runcode exec(code, self.locals) File "W:\HQ Trivia\HackQ-Trivia\hq_main.py", line 47, in asyncio.get_event_loop().run_until_complete(networking.websocket_handler(socket, headers)) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 454, in run_until_complete self.run_forever() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 421, in run_forever self._run_once() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 1431, in _run_once handle._run() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\events.py", line 145, in _run self._callback(self._args) File "W:\HQ Trivia\HackQ-Trivia\networking.py", line 17, in fetch logging.error(type(e), e) Message: <class 'concurrent.futures._base.TimeoutError'> Arguments: (TimeoutError(),) Server timeout/error to https://vicks.com/en-us/safety-and-faqs/faqs/vicks-vaporub-faq --- Logging error --- Traceback (most recent call last): File "W:\HQ Trivia\HackQ-Trivia\networking.py", line 13, in fetch async with session.get(url, timeout=timeout) as response: File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 782, in aenter__ self._resp = await self._coro File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client.py", line 332, in _request await resp.start(conn, read_until_eof) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\client_reqrep.py", line 691, in start self._continue = None File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\site-packages\aiohttp\helpers.py", line 661, in exit__ raise asyncio.TimeoutError from None concurrent.futures._base.TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging__init.py", line 992, in emit msg = self.format(record) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging\init.py", line 838, in format return fmt.format(record) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging\init.py", line 575, in format record.message = record.getMessage() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\logging\init__.py", line 338, in getMessage msg = msg % self.args TypeError: not all arguments converted during string formatting Call stack: File "", line 1, in File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\idlelib\run.py", line 144, in main ret = method(*args, *kwargs) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\idlelib\run.py", line 474, in runcode exec(code, self.locals) File "W:\HQ Trivia\HackQ-Trivia\hq_main.py", line 47, in asyncio.get_event_loop().run_until_complete(networking.websocket_handler(socket, headers)) File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 454, in run_until_complete self.run_forever() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 421, in run_forever self._run_once() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 1431, in _run_once handle._run() File "C:\Users\blah\AppData\Local\Programs\Python\Python36-32\lib\asyncio\events.py", line 145, in _run self._callback(self._args) File "W:\HQ Trivia\HackQ-Trivia\networking.py", line 17, in fetch logging.error(type(e), e) Message: <class 'concurrent.futures._base.TimeoutError'> Arguments: (TimeoutError(),)`

Exaphis commented 6 years ago

The error printed is fixed in https://github.com/Exaphis/HackQ-Trivia/commit/73bd4e5d4923f8626f9262af91844398bc3d38e0. I will be putting answer highlighting on the todo list.

tdaddy commented 6 years ago

yesss. i definitely second the highlighting of the answers. that would be super helpful