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

SNKRSMonitor sending incorrect links to US users (with fix) #75

Closed smacoun closed 3 years ago

smacoun commented 3 years ago

Users with "US" location selected in line 9 of "Sneaker-Monitors/SNKRS/.env" as seen below:

"LOC = "US"

Receive broken links for Nike products when the monitor posts to discord.

I noticed that the monitor is appending "/US" to the links after nike.com as seen in the example below:

https://www.nike.com/US/launch/t/air-force-1-07-mens-shoe-5QFp5Z (broken link sent by monitor) https://www.nike.com/launch/t/air-force-1-07-mens-shoe-5QFp5Z (proper working link)

The online Nike store for the US does not use a location code like other countries.

I found a fix for this by editing line line 75 of "SNKRSMonitor.py" and removing "/{CONFIG["LOC"]}" as seen below:

embed["url"] = f'https://www.nike.com/{CONFIG["LOC"]}/launch/t/' + slug (original code) embed["url"] = f'https://www.nike.com/launch/t/' + slug (edit for proper US SNKRS links)

I hope you find this "fix" for US users helpful. Thank you for sharing such a well thought out project.

yasserqureshi1 commented 3 years ago

Thank you for pointing this out! I'll mention this in the documentation