Skip to content

Commit

Permalink
Accessing meta sometimes causes memory leaks, apparently
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinn committed Oct 28, 2023
1 parent 1eca46f commit 00e7d5e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion price_monitor/spiders/backcountry.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class BackcountrySpider(CrawlSpider):
]

def parse_detail_page(self, response):
item = response.meta.get('item', {})
item = {} # response.meta.get('item', {})
item['url'] = response.url
brand = response.css(BRAND_SELECTOR).extract_first("").strip()
item['title'] = f"""{brand} {response.css(TITLE_SELECTOR).extract_first("").strip()}"""
Expand Down
2 changes: 1 addition & 1 deletion price_monitor/spiders/montbell.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MontbellSpider(CrawlSpider):
]

def parse_detail_page(self, response):
item = response.meta.get('item', {})
item = {} # response.meta.get('item', {})
item['url'] = response.url
item['title'] = response.css(TITLE_SELECTOR).extract_first("").strip()
item['price'] = self.get_price(response)
Expand Down
2 changes: 1 addition & 1 deletion price_monitor/spiders/patagonia.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def parse_detail_page(self, response):
@scrapes url title price
"""
self.logger.info('Parse Detail Page function called on %s', response.url)
item = response.meta.get('item', {})
item = {} # response.meta.get('item', {})
item['url'] = response.url
item['title'] = response.css(TITLE_SELECTOR).extract_first("").strip()
item['price'] = self.get_price(response)
Expand Down
2 changes: 1 addition & 1 deletion price_monitor/spiders/rei.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def parse_detail_page(self, response):
try:
product = json.loads(response.xpath('//script[@type="application/ld+json"]//text()').extract_first())

item = response.meta.get('item', {})
item = {} # response.meta.get('item', {})
item['url'] = response.url
item['title'] = product.get('name')
item['price'] = self.get_price(product) or 0
Expand Down
2 changes: 1 addition & 1 deletion price_monitor/spiders/trekkinn.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TrekkinnSpider(CrawlSpider):
]

def parse_detail_page(self, response):
item = response.meta.get('item', {})
item = {} # response.meta.get('item', {})
item['url'] = response.url
item['title'] = response.css(TITLE_SELECTOR).extract_first("").strip()
item['price'] = self.get_price(response)
Expand Down

0 comments on commit 00e7d5e

Please sign in to comment.