alltheplaces / alltheplaces

A set of spiders and scrapers to extract location information from places that post their location on the internet.
https://www.alltheplaces.xyz
Other
625 stars 213 forks source link

UBB Bank #5865

Closed Dimitar5555 closed 2 months ago

Dimitar5555 commented 1 year ago

Brand name

UBB / ОББ

Wikidata ID

Q7887555

Store finder url(s)

https://www.ubb.bg/offices/pins?city_id=&srch_offices=&_=1694684624025

pin_type is used to diffrentiate between offices and atms.

Cj-Malone commented 1 year ago

Javascript drama

from scrapy import Spider

from locations.categories import Categories, Extras, apply_category, apply_yes_no
from locations.dict_parser import DictParser

class UbbBGSpider(Spider):
    name = "ubb_bg"
    item_attributes = {"brand_wikidata": "Q7887555"}
    start_urls = ["https://www.ubb.bg/offices/pins"]

    def parse(self, response, **kwargs):
        print(response.text)
        for location in response.json()["markers"]["offices"]:
            item = DictParser.parse(location["data"])

            apply_yes_no(Extras.WHEELCHAIR, item, location["data"]["has_accessibility"])

            if location["data"]["pin_type"] == "offices":
                apply_category(Categories.BANK, item)
            else:
                apply_category(Categories.ATM, item)

            yield item
Dimitar5555 commented 1 year ago

The ATMs are located in ["markers"]["atms"].

I've just noticed that they also list their child's bank offices and ATMs. When pin_type is kbc_office or kbc_atms, it should get brand=UBB* + brand:wikidata=Q7283808. That brand is not added to NSI because of https://github.com/osmlab/name-suggestion-index/issues/8626.