Repository: alltheplaces/alltheplaces

Issue:
Ra Sushi
https://rasushi.com/locations/


Discussion:
Hello, I am new to open source and looking for an issue to contribute to. Is it possible to explain what I need to do to fix this issue? Thank you in advanced
@wuteek Hello, thanks for reaching out. I've labeled issues in the repository that are good options for creating your first spider. The ultimate goal is to scrape the URL linked above (or a better one if you find it) for [location information](https://github.com/alltheplaces/alltheplaces/blob/master/DATA_FORMAT.md) regarding the business. The project is built using [scrapy](https://docs.scrapy.org/en/latest/), so there is more documentation there the can also assist you as well. Feel free to comb through the spiders in the [locations folder](https://github.com/alltheplaces/alltheplaces/tree/master/locations) for guidance on completed spiders, see [university_maryland_medical_system.py](https://github.com/alltheplaces/alltheplaces/blob/43ae0183827f340925555029e26b3810730be268/locations/spiders/university_maryland_medical_system.py) and [credit_agricole.py](https://github.com/alltheplaces/alltheplaces/blob/c0b9dfe7379e8fef192fc319fcebe2b10b352204/locations/spiders/credit_agricole.py) as examples. If you find an issue that you think looks interesting, let me know and I will assign it to you, and feel free to reach out if you have more questions.
Hello! I just created a pull request for this issue. Please let me know if there is something I need to fix. Thank you! 

Resolving patch:
diff --git a/locations/spiders/ra_sushi.py b/locations/spiders/ra_sushi.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/ra_sushi.py
@@ -0,0 +1,62 @@
+import scrapy
+
+from locations.items import GeojsonPointItem
+
+
+class RaSushiSpider(scrapy.spiders.SitemapSpider):
+    name = "ra_sushi"
+    item_attributes = {
+        "brand": "RA Sushi",
+    }
+
+    sitemap_urls = ["https://rasushi.com/stores-sitemap.xml"]
+    sitemap_rules = [("/locations/.+", "parse_store")]
+
+    def parse_store(self, response):
+        if response.url == "https://rasushi.com/locations/":
+            return  # not found, redirects
+
+        location = response.xpath("//div[@id='store_locator_single_map']")
+        address = response.xpath("//span[@class='addressGet']//text()").extract()
+        type = response.xpath("//span[@class='devOp1']/text()").extract_first()
+        addr_dict = self.parse_address(address, type)
+
+        yield GeojsonPointItem(
+            ref=response.url.split("/")[-2],
+            name=response.xpath("//h1[@class='title']/text()").extract_first().strip(),
+            lat=location.xpath("@data-lat").extract_first(),
+            lon=location.xpath("@data-lng").extract_first(),
+            street_address=addr_dict.get("street_addresss", None),
+            city=addr_dict["city"],
+            state=addr_dict["state"],
+            postcode=addr_dict.get("postcode", None),
+            country="US",
+            phone=response.xpath("//a[@class='telLoc']/text()").extract_first(),
+            website=response.url,
+        )
+
+    @staticmethod
+    def parse_address(address, type):
+        if "Delivery Only" in type:
+            if len(address) == 1:
+                addr_dict = {
+                    "city": address[0].split(",")[0].strip(),
+                    "state": address[0].split(",")[1].strip().split(" ")[0].strip(),
+                }
+            else:
+                addr_dict = {
+                    "city": address[0].strip(),
+                    "state": address[1].strip().split(" ")[0].strip(),
+                }
+        else:
+            city_state = address[-1]
+            addr_dict = {
+                "street_address": ",".join(address[0:2])
+                if len(address) == 3
+                else address[0].strip(),
+                "city": city_state.split(",")[0].strip(),
+                "state": city_state.split(",")[1].strip().split(" ")[0].strip(),
+                "postcode": city_state.split(",")[-1].strip().split(" ")[1].strip(),
+            }
+
+        return addr_dict


Test patch: