Skip to content

Commit

Permalink
Update query param extractor method
Browse files Browse the repository at this point in the history
  • Loading branch information
borys25ol committed Jun 15, 2024
1 parent 62e3ffd commit 21c3403
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crawl/spiders/reverb_com.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ReverbComSpider(Spider):
def start_requests(self) -> Iterator[Request]:
for item in get_scraping_links():
if "query" in item["link"]:
query = self._extract_search_param(url=item["link"])
query = self._extract_query_param(url=item["link"], name="query")
payload = self._build_search_request_payload(query=query)
callback = self.parse_reverb_search_api
else:
Expand Down Expand Up @@ -135,8 +135,8 @@ def _extract_url_slug(url: str) -> str:
return urlparse(url).path.split("/")[-1]

@staticmethod
def _extract_search_param(url: str) -> str:
return parse_qs(qs=urlparse(url).query)["query"][0]
def _extract_query_param(url: str, name: str) -> str:
return parse_qs(qs=urlparse(url).query)[name][0]

@staticmethod
def _build_product_request_payload(
Expand Down

0 comments on commit 21c3403

Please sign in to comment.