Skip to content

Commit

Permalink
Merge pull request #357 from alltheplaces/western-family
Browse files Browse the repository at this point in the history
Western Family
  • Loading branch information
iandees committed Dec 11, 2017
2 parents 9c4ffce + 3927dd8 commit 27c0314
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions locations/spiders/western_family.py
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
import scrapy
import json

from locations.items import GeojsonPointItem


class WesternFamilySpider(scrapy.Spider):

name = "western_family"
allowed_domains = ["www.westernfamily.com"]
start_urls = (
'http://www.westernfamily.com/wp-admin/admin-ajax.php?action=store_search&lat=45.5230622&lng=-122.67648159999999&max_results=2500&search_radius=50000&autoload=1',
)

def parse(self, response):
results = json.loads(response.body_as_unicode())
for data in results:
properties = {
'ref': data['id'],
'name': data['store'],
'lat': data['lat'],
'lon': data['lng'],
'addr_full': data['address'],
'city': data['city'],
'state': data['state'],
'postcode': data['zip'],
'country': data['country'],
'phone': data['phone'],
'website': data['url'],
}

yield GeojsonPointItem(**properties)

0 comments on commit 27c0314

Please sign in to comment.