Spaces:
Runtime error
Runtime error
Commit ·
643dbca
1
Parent(s): c2ded9d
Update scraper/utils/TargetScraper.py
Browse files113 unmodified lines11411511611711811912011 unmodified lines132133134135136137138113 unmodified lines# Extract the matches using re.findallmatches = [re.findall(pattern, url)[0] for url in urls]print(matches)return urlsdef get_sub_category_page(self, url):# 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}"11 unmodified linesresponse = self.session.get(sub_category_url, headers=self.headers)except:return Falseprint(response.json())# x.data.search.productstry:products = response.json()['data']['search']['products']113 unmodified lines11411511611711811912011 unmodified lines132133134135136137138113 unmodified lines# Extract the matches using re.findallmatches = [re.findall(pattern, url)[0] for url in urls]print(matches)return matchesdef get_sub_category_page(self, url):# 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}"11 unmodified linesresponse = self.session.get(sub_category_url, headers=self.headers)except:return Falseprint(response.json(), 'Sub Category')# x.data.search.productstry:products = response.json()['data']['search']['products']
scraper/utils/TargetScraper.py+2-2