fixed rewards and maybe time too?

This commit is contained in:
jenz 2024-06-08 22:20:57 +02:00
parent 68737ea990
commit ce5f153ebc

View File

@ -62,6 +62,8 @@ class unloze_spider(scrapy.Spider):
next_event_time = False next_event_time = False
next_event_reward = False next_event_reward = False
event_date = None event_date = None
event_reward = ""
event_time = ""
for r in response.xpath("//*[contains(text(),'TL;DR')]/../../..//text()").extract(): for r in response.xpath("//*[contains(text(),'TL;DR')]/../../..//text()").extract():
if "\n" in r or len(r) < 4 or "\t" in r or skipping > 0: if "\n" in r or len(r) < 4 or "\t" in r or skipping > 0:
if r.lower() == "tl;dr": if r.lower() == "tl;dr":
@ -95,14 +97,16 @@ class unloze_spider(scrapy.Spider):
if "time" in r.lower() and "server" not in r.lower(): if "time" in r.lower() and "server" not in r.lower():
next_event_time = True next_event_time = True
continue continue
if next_event_time: if next_event_time and event_time == "":
event_time = r event_time = r
next_event_time = False next_event_time = False
if "rewards" in r.lower(): if "rewards" in r.lower():
next_event_reward = True next_event_reward = True
#print("rewards: ", r)
continue continue
if next_event_reward: if next_event_reward and event_reward == "":
#print("next_event_reward: ", r)
event_reward = r event_reward = r
next_event_reward = False next_event_reward = False
@ -123,4 +127,4 @@ class unloze_spider(scrapy.Spider):
sys.exit(1) sys.exit(1)
#pprint(self.item) #pprint(self.item)
return self.item return self.item