Skip to content

Commit

Permalink
fix spiders (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksey-vasilev authored Aug 10, 2024
2 parents 1584bc1 + bd88030 commit 0b5b527
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/grabber/nsreg/spiders/nsreg_opencom.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def __init__(self, *args, **kwargs):
site_names=self.site_names,
regex=r"([0-9]+)₽.*",
path={
'price_reg': 'translate(/html/body/div[1]/div/main/div/div/div/article/div/div/div/section[3]/div/div/div/div[3]/div/table/tbody/tr[2]/td[2]/text(), " ", "")',
'price_prolong': 'translate(/html/body/div[1]/div/main/div/div/div/article/div/div/div/section[3]/div/div/div/div[3]/div/table/tbody/tr[3]/td[2]/text(), " ", "")',
'price_change': 'translate(/html/body/div[1]/div/main/div/div/div/article/div/div/div/section[3]/div/div/div/div[3]/div/table/tbody/tr[4]/td[2]/text(), " ", "")',
'price_reg': 'translate(/html/body/div[1]/div/main/div/div/div/article/div/div/section[3]/div/div/div/div[3]/div/table/tbody/tr[3]/td[2]/p/text(), " ", "")',
'price_prolong': 'translate(/html/body/div[1]/div/main/div/div/div/article/div/div/section[3]/div/div/div/div[3]/div/table/tbody/tr[4]/td[2]/p/text(), " ", "")',
'price_change': 'translate(/html/body/div[1]/div/main/div/div/div/article/div/div/section[3]/div/div/div/div[3]/div/table/tbody/tr[5]/td[2]/p/text(), " ", "")',
},
)

Expand Down
16 changes: 11 additions & 5 deletions src/grabber/nsreg/spiders/nsreg_openreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@ def __init__(self, *args, **kwargs):
start_urls=self.start_urls,
allowed_domains=self.allowed_domains,
site_names=self.site_names,
regex=r"([0-9]+)₽.*",
regex=r"([0-9]+)\s+₽.*",
path={
'price_reg': 'translate(/html/body/section[3]/div/div[1]/div[2]/div[2]/text(), " ", "")',
'price_prolong': 'translate(/html/body/section[3]/div/div[1]/div[3]/div[2]/text(), " ", "")',
'price_change': 'translate(/html/body/section[3]/div/div[1]/div[4]/div[2]/text(), " ", "")',
},
'price_reg': (
'/html/body/div[1]/div/div/div/main/article/div/div/div[4]/div/div/div[5]/div/div/div/div/table/tbody/tr[1]/td[2]/div/p/text()'
),
'price_prolong': (
'/html/body/div[1]/div/div/div/main/article/div/div/div[4]/div/div/div[5]/div/div/div/div/table/tbody/tr[2]/td[2]/div/p/text()'
),
'price_change': (
'/html/body/div[1]/div/div/div/main/article/div/div/div[4]/div/div/div[5]/div/div/div/div/table/tbody/tr[3]/td[2]/div/p/text()'
)
}
)

def parse(self, response):
Expand Down
2 changes: 1 addition & 1 deletion src/grabber/nsreg/spiders/nsreg_royaldomains.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class NsregRoyaldomainsSpider(scrapy.Spider):
site_names = ('ООО «РОЯЛЬ»',)
custom_settings = {
'DOWNLOAD_DELAY': 3,
'RANDOMIZE_DOWNLOAD_DELAY': False
'RANDOMIZE_DOWNLOAD_DELAY': True
}

# Конструктор класса
Expand Down

0 comments on commit 0b5b527

Please sign in to comment.