yasserqureshi1 / Sneaker-Monitors

A collection of web monitors that notify of restocks or updates on sneaker related sites through Discord Webhook. This includes Shopify, Nike SNKRS (supports 42 countries), Supreme and now Footsite monitors!
GNU General Public License v3.0
463 stars 125 forks source link

Kith EU Shopify Error #110

Closed haroonjamil closed 2 years ago

haroonjamil commented 2 years ago

Exception found: Traceback (most recent call last): File "ShopifyMonitor.py", line 199, in monitor items = scrape_site(CONFIG['URL'], proxy, headers) File "ShopifyMonitor.py", line 44, in scrape_site output = json.loads(html.text)['products'] File "/usr/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/usr/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Be getting this error per request.

yasserqureshi1 commented 2 years ago

Usually this error pops up when the monitor is unable to scrape the content of the site correctly as the page is not a JSON endpoint. For example a Kith EU endpoint could be: https://eu.kith.com/collections/kith-summer-2021/products.json

If this is not the issue that you are facing, then please reopen this issue

haroonjamil commented 2 years ago

The URL is right, but I ran 2 Kith EU monitors on one single server. One for Men, and one for Women's footwear. May that have caused it to happen?

haroonjamil commented 2 years ago

Exception found: Traceback (most recent call last): File "ShopifyMonitor.py", line 199, in monitor items = scrape_site(CONFIG['URL'], proxy, headers) File "ShopifyMonitor.py", line 44, in scrape_site output = json.loads(html.text)['products'] File "/usr/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/usr/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Ran one monitor on one good server again and this happened. Using this URL. : https://eu.kith.com/collections/mens-footwear/products.json

yasserqureshi1 commented 2 years ago

Try to increase the delay. This can also happen when the monitor scrapes too quickly and hits rate limiters.

yasserqureshi1 commented 2 years ago

Exception found: Traceback (most recent call last): File "ShopifyMonitor.py", line 199, in monitor items = scrape_site(CONFIG['URL'], proxy, headers) File "ShopifyMonitor.py", line 44, in scrape_site output = json.loads(html.text)['products'] File "/usr/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/usr/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Ran one monitor on one good server again and this happened. Using this URL. : https://eu.kith.com/collections/mens-footwear/products.json

Btw I was checking my monitor that I've got running and I noticed it does do that from time-to-time, but it usually stops due to rotating proxies. I found that increasing delays between scrapes helps loads.