add going, interested, shared fields to eventsitem

This commit is contained in:
Eliezer Pearl 2019-07-18 12:30:51 -04:00
parent 388da75075
commit 03e65d5fcc
8 changed files with 9 additions and 5 deletions

View File

@ -647,3 +647,6 @@ class EventsItem(scrapy.Item):
start_date = scrapy.Field()
end_date = scrapy.Field()
description = scrapy.Field()
going = scrapy.Field()
interested = scrapy.Field()
shared = scrapy.Field()

View File

@ -14,7 +14,8 @@ class EventsSpider(FacebookSpider):
name = "events"
custom_settings = {
'FEED_EXPORT_FIELDS': ['name','where','location','photo','start_date', \
'end_date','description'],
'end_date','description', 'going', 'interested', \
'shared'],
'DUPEFILTER_CLASS' : 'scrapy.dupefilters.BaseDupeFilter',
'CONCURRENT_REQUESTS' : 1
}
@ -44,7 +45,7 @@ class EventsSpider(FacebookSpider):
EVENT_COVER='/html/body/div/div/div[2]/div/table/tbody/tr/td/div[2]/div[1]/a/img/@src'
GOING='/html/body/div/div/div[2]/div/table/tbody/tr/td/table/tbody/tr/td/div[2]/div[2]/div/div/div/div[2]/a/text()'
INTERESTED='/html/body/div/div/div[2]/div/table/tbody/tr/td/table/tbody/tr/td/div[2]/div[2]/div/div/div[2]/div[2]/a/text()'
SHARED='/html/body/div/div/div[2]/div/table/tbody/tr/td/table/tbody/tr/td/div[2]/div[2]/div/div/div[3]/div[2]/a/text()'
SHARED='/html/body/div/div/div[2]/div/table/tbody/tr/td/table/tbody/tr/td/div[2]/div[2]/div/div/div[3]/div[2]/div/text()'
date = response.xpath(DATE).extract_first()
start_date = date.split('')[0] or None
end_date = date.split('')[1] or None
@ -57,8 +58,8 @@ class EventsSpider(FacebookSpider):
photo=response.xpath(EVENT_COVER).extract_first(),
start_date=start_date,
end_date=end_date,
description=response.xpath(EVENT_DESCRIPTION).extract_first()
going=response.xpath(GOING).extract_first()
interested=response.xpath(INTERESTED).extract_first()
description=response.xpath(EVENT_DESCRIPTION).extract_first(),
going=response.xpath(GOING).extract_first(),
interested=response.xpath(INTERESTED).extract_first(),
shared=response.xpath(SHARED).extract_first()
)