Spaces:
Runtime error
Runtime error
Commit
·
643dbca
1
Parent(s):
c2ded9d
Update scraper/utils/TargetScraper.py
Browse files
scraper/utils/TargetScraper.py
CHANGED
|
@@ -114,7 +114,7 @@ class TargetScraper:
|
|
| 114 |
# Extract the matches using re.findall
|
| 115 |
matches = [re.findall(pattern, url)[0] for url in urls]
|
| 116 |
print(matches)
|
| 117 |
-
return
|
| 118 |
|
| 119 |
def get_sub_category_page(self, url):
|
| 120 |
# sub_category_url = f"https://redsky.target.com/redsky_aggregations/v1/web/product_summary_with_fulfillment_v1?key=9f36aeafbe60771e321a7cc95a78140772ab3e96&tcins=15847564%2C75557589%2C78809748%2C13347903%2C13347898%2C13302603%2C11046774%2C14827710%2C17447006%2C16649805%2C82347297%2C53079917%2C16821449%2C83067937%2C86217754%2C15150353%2C14502619%2C46806870%2C51107346%2C76858885%2C14688252%2C76534688%2C14214405%2C51612206%2C14686468%2C75557589%2C14923389%2C50045818%2C15118350&store_id=146&zip=37250&state=PB&latitude=31.270&longitude=73.320&required_store_id=146&has_required_store_id=true&skip_price_promo=true&channel=WEB&page=%2Fc%2F{url}"
|
|
@@ -132,7 +132,7 @@ class TargetScraper:
|
|
| 132 |
response = self.session.get(sub_category_url, headers=self.headers)
|
| 133 |
except:
|
| 134 |
return False
|
| 135 |
-
print(response.json())
|
| 136 |
# x.data.search.products
|
| 137 |
try:
|
| 138 |
products = response.json()['data']['search']['products']
|
|
|
|
| 114 |
# Extract the matches using re.findall
|
| 115 |
matches = [re.findall(pattern, url)[0] for url in urls]
|
| 116 |
print(matches)
|
| 117 |
+
return matches
|
| 118 |
|
| 119 |
def get_sub_category_page(self, url):
|
| 120 |
# sub_category_url = f"https://redsky.target.com/redsky_aggregations/v1/web/product_summary_with_fulfillment_v1?key=9f36aeafbe60771e321a7cc95a78140772ab3e96&tcins=15847564%2C75557589%2C78809748%2C13347903%2C13347898%2C13302603%2C11046774%2C14827710%2C17447006%2C16649805%2C82347297%2C53079917%2C16821449%2C83067937%2C86217754%2C15150353%2C14502619%2C46806870%2C51107346%2C76858885%2C14688252%2C76534688%2C14214405%2C51612206%2C14686468%2C75557589%2C14923389%2C50045818%2C15118350&store_id=146&zip=37250&state=PB&latitude=31.270&longitude=73.320&required_store_id=146&has_required_store_id=true&skip_price_promo=true&channel=WEB&page=%2Fc%2F{url}"
|
|
|
|
| 132 |
response = self.session.get(sub_category_url, headers=self.headers)
|
| 133 |
except:
|
| 134 |
return False
|
| 135 |
+
print(response.json(), 'Sub Category')
|
| 136 |
# x.data.search.products
|
| 137 |
try:
|
| 138 |
products = response.json()['data']['search']['products']
|