vlourme / vintedpy

Get alerted on Discord when new Vinted articles are published 🛒
GNU General Public License v3.0
29 stars 9 forks source link

Subscription crashes #6

Closed drew-dev12 closed 1 year ago

drew-dev12 commented 1 year ago

Hello there,

When setting up a subscription it crashes. The input is "/subscribe channel: #jackets url: https://www.vinted.fr/catalog?search_text=carhart"

Any idea why this is happening?

Thanks!

E 2023-01-28 02:17:30,709 hikari.event_manager: an exception occurred handling an event (InteractionCreateEvent) Traceback (most recent call last): File "C:\Users\Drew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\lightbulb\app.py", line 1163, in invoke_application_command await context.invoke() File "C:\Users\Drew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\lightbulb\context\base.py", line 328, in invoke await self.command.invoke(self) File "C:\Users\Drew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\lightbulb\commands\base.py", line 775, in invoke await self(context, kwargs) File "C:\Users\Drew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\lightbulb\commands\base.py", line 690, in call return await self.callback(context, kwargs) File "C:\Users\Drew\AppData\Local\Programs\Python\Projects\vintedpy-main\main.py", line 57, in subscribe table.insert({ File "C:\Users\Drew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\dataset\table.py", line 118, in insert row = self._sync_columns(row, ensure, types=types) File "C:\Users\Drew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\dataset\table.py", line 381, in _sync_columns self._sync_table(sync_columns.values()) File "C:\Users\Drew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\dataset\table.py", line 324, in _sync_table self._reflect_table() File "C:\Users\Drew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\dataset\table.py", line 306, in _reflect_table self.name, self.db.metadata, schema=self.db.schema, autoload=True File "C:\Users\Drew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\dataset\database.py", line 109, in metadata return MetaData(schema=self.schema, bind=self.executable) TypeError: MetaData.init() got an unexpected keyword argument 'bind'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\Drew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\lightbulb\app.py", line 1204, in handle_interaction_create_for_application_commands await self.invoke_application_command(context) File "C:\Users\Drew\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\lightbulb\app.py", line 1181, in invoke_application_command raise new_exc lightbulb.errors.CommandInvocationError: An error occurred during command 'subscribe' invocation

vlourme commented 1 year ago

Hello, can you try again with the latest version of the bot ? Also, have you followed the README correctly and selected correct permissions?

drew-dev12 commented 1 year ago

Hello - yes it's now working! It's great.

I have had the following error twice after running it for a couple hour FYI:

2023-05-11 15:29:13.765 | DEBUG | main:run_background:26 - 0 found for 1 OrderedDict([('id', 2), ('url', 'https://www.vinted.co.uk/catalog?search_text=&catalog[]=1206&price_from=0.0&price_to=60.0&currency=GBP&search_id=7719517575&order=newest_first'), ('channel_id', 1068713486990966926), ('last_sync', 1683815099)]) E 2023-05-11 15:29:14,179 asyncio: Task exception was never retrieved future: <Task finished name='Task-22' coro=<run_background() done, defined at /home/drew/Projects/vintedpy-main/vintedpy-main/main.py:18> exception=TypeError("'NoneType' object is not subscriptable")> Traceback (most recent call last): File "/home/drew/Projects/vintedpy-main/vintedpy-main/main.py", line 25, in run_background items = scrape(db, sub) File "/home/drew/Projects/vintedpy-main/vintedpy-main/scraper.py", line 46, in scrape timestamp = item['photo']['high_resolution']['timestamp'] TypeError: 'NoneType' object is not subscriptable

vlourme commented 1 year ago

Great! Concerning the error by looking at the stacktrace, it seems the Vinted API responded with a wrong item that does not have any timestamp, but this bot uses timestamp to keep track of what items already have been alerted.

I'll push a fix tomorrow. I keep the issue open until this is completely fixed. Thank you for reporting 👍

vlourme commented 1 year ago

This should be fixed, feel free to reopen if the issue persists