forked from alltheplaces/alltheplaces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmoes_southwest_grill.py
27 lines (22 loc) · 920 Bytes
/
moes_southwest_grill.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
from scrapy.spiders import SitemapSpider
from locations.items import set_closed
from locations.structured_data_spider import StructuredDataSpider
class MoesSouthwestGrillSpider(SitemapSpider, StructuredDataSpider):
name = "moes_southwest_grill"
item_attributes = {
"brand": "Moe's Southwest Grill",
"brand_wikidata": "Q6889938",
}
sitemap_urls = ["https://locations.moes.com/robots.txt"]
sitemap_rules = [
(r"locations\.moes\.com/.*/.*/.*$", "parse_sd"),
]
drop_attributes = {"image"}
def post_process_item(self, item, response, ld_data, **kwargs):
if name := item.get("name"):
if name.endswith("- Temporarily Closed"):
pass # TODO?
elif item["name"].endswith("- Closed"):
set_closed(item)
item["branch"] = item.pop("name").removeprefix("Moe's Southwest Grill ")
yield item