-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathnsreg_domainshop.py
32 lines (27 loc) · 1.44 KB
/
nsreg_domainshop.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
import scrapy
from ..base_site_spider import BaseSpiderComponent
class NsregDomainshopSpider(scrapy.Spider):
name = "nsreg_domainshop.py"
start_urls = ["https://domainshop.ru/services/"]
allowed_domains = ("domainshop.ru")
site_names = ("ООО «Лавка доменов»",)
# Конструктор класса
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Инициализация компонента BaseSpiderComponent с требуемыми параметрами
self.component = BaseSpiderComponent(
start_urls=self.start_urls,
allowed_domains=self.allowed_domains,
site_names=self.site_names,
regex=r"([0-9]+)[.,\s]?руб.*",
path={
'price_reg': '/html/body/div/div[2]/div/div/div/div/div[3]/div/div/div/div/table/tbody/tr[1]/td[2]/div/text()',
'price_prolong': '/html/body/div/div[2]/div/div/div/div/div[3]/div/div/div/div/table/tbody/tr[4]/td[2]/div/p/text()',
'price_change': '/html/body/div/div[2]/div/div/div/div/div[3]/div/div/div/div/table/tbody/tr[7]/td[2]/div/text()'
}
)
# Метод для обработки ответов на запросы
def parse(self, response):
# Применение метода parse компонента BaseSpiderComponent
return self.component.parse(response)