-
Notifications
You must be signed in to change notification settings - Fork 0
/
items.py
26 lines (24 loc) · 853 Bytes
/
items.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
import scrapy
from itemloaders.processors import TakeFirst, MapCompose
from w3lib.html import remove_tags
class PeriodicElementItem(scrapy.Item):
symbol = scrapy.Field(
input_processor=MapCompose(remove_tags, str.strip),
output_processor=TakeFirst()
)
name = scrapy.Field(
input_processor=MapCompose(remove_tags, str.strip),
output_processor=TakeFirst()
)
atomic_number = scrapy.Field(
input_processor=MapCompose(remove_tags, str.strip, int),
output_processor=TakeFirst()
)
atomic_mass= scrapy.Field(
input_processor=MapCompose(remove_tags, str.strip, float),
output_processor=TakeFirst()
)
chemical_group = scrapy.Field(
input_processor=MapCompose(remove_tags, str.strip),
output_processor=TakeFirst()
)