kensvin commited on
Commit
f32ae2a
·
1 Parent(s): 470bdb8

fix url parsing

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -204,7 +204,7 @@ def scrape(product_id, max_reviews=LIMIT):
204
  # Function to extract product ID from URL
205
  def get_product_id(URL):
206
  parsed_url = urlparse(URL)
207
- _, shop, product_key = parsed_url.path.strip("/").split("/")
208
  response = request_product_id(shop, product_key)
209
  if response:
210
  product_id = response.json()["data"]["pdpGetLayout"]["basicInfo"]["id"]
 
204
  # Function to extract product ID from URL
205
  def get_product_id(URL):
206
  parsed_url = urlparse(URL)
207
+ *_, shop, product_key = parsed_url.path.split("/")
208
  response = request_product_id(shop, product_key)
209
  if response:
210
  product_id = response.json()["data"]["pdpGetLayout"]["basicInfo"]["id"]