Exemplo n.º 1
0
    def parse(self, response):

        r = json.loads(response.body_as_unicode())

        for m in r['response']:
            item = HowardBirnbaumItem()
            try:
                item['company'] = m['name']
            except Exception as e:
                print(e)
            try:
                item['address'] = m['address'] + ' ' + m['address2']
            except Exception as e:
                print(e)
            try:
                item['state'] = m['state']
            except Exception as e:
                print(e)
            try:
                item['country'] = m['country']
            except Exception as e:
                print(e)
            try:
                item['phone_number'] = m['data']['sl_phone']
            except Exception as e:
                print(e)
            try:
                item['web_site_url'] = m['url']
            except Exception as e:
                print(e)
            try:
                item['email'] = m['email']
            except Exception as e:
                print(e)
            try:
                item['city'] = m['city']
            except Exception as e:
                print(e)
            try:
                item['postal_code'] = m['zip']
            except Exception as e:
                print(e)

            yield item
Exemplo n.º 2
0
    def parse(self, response):

        j = json.loads(re.findall(r'\((.*)\)', response.body_as_unicode())[0])

        for m in j[0]:
            item = HowardBirnbaumItem()
            try:
                item['company'] = m['name']
            except Exception as e:
                print(e)
            try:
                item['address'] = m['address'] + ' ' + m['address2']
            except Exception as e:
                print(e)
            try:
                item['state'] = m['state']
            except Exception as e:
                print(e)
            try:
                item['country'] = ''
            except Exception as e:
                print(e)
            try:
                item['phone_number'] = m['phone']
            except Exception as e:
                print(e)
            try:
                item['web_site_url'] = m['url']
            except Exception as e:
                print(e)
            try:
                item['email'] = ''
            except Exception as e:
                print(e)
            try:
                item['city'] = m['city']
            except Exception as e:
                print(e)
            try:
                item['postal_code'] = m['postal']
            except Exception as e:
                print(e)

            yield item
Exemplo n.º 3
0
    def parse(self, response):

        pq = PyQuery(response.body_as_unicode())

        item = HowardBirnbaumItem()
        try:
            item['company'] = pq('[class="profileHeaderContainer"] h3').text()
        except Exception as e:
            print(e)
        try:
            item['address'] = ''
        except Exception as e:
            print(e)
        try:
            item['state'] = ''
        except Exception as e:
            print(e)
        try:
            item['country'] = ''
        except Exception as e:
            print(e)
        try:
            item['phone_number'] = ''
        except Exception as e:
            print(e)
        try:
            item['web_site_url'] = pq(
                '[class="fieldBody"] [href*="http"]').text()
        except Exception as e:
            print(e)
        try:
            item['email'] = pq('[class="fieldBody"] [href*="mailto:"]').text()
        except Exception as e:
            print(e)
        try:
            item['city'] = ''
        except Exception as e:
            print(e)
        try:
            item['postal_code'] = ''
        except Exception as e:
            print(e)

        yield item
Exemplo n.º 4
0
    def parse(self, response):

        pq = PyQuery(response.body_as_unicode())

        for m in pq('table tr [valign="top"]'):
            item = HowardBirnbaumItem()
            try:
                item['company'] = pq(m)('.dealer-titles').text()
            except Exception as e:
                print(e)
            try:
                item['address'] = pq(m)('p').text()
            except Exception as e:
                print(e)
            try:
                item['state'] = m['state']
            except Exception as e:
                print(e)
            try:
                item['country'] = m['country']
            except Exception as e:
                print(e)
            try:
                item['phone_number'] = m['data']['sl_phone']
            except Exception as e:
                print(e)
            try:
                item['web_site_url'] = m['url']
            except Exception as e:
                print(e)
            try:
                item['email'] = m['email']
            except Exception as e:
                print(e)
            try:
                item['city'] = m['city']
            except Exception as e:
                print(e)
            try:
                item['postal_code'] = m['zip']
            except Exception as e:
                print(e)

            yield item
Exemplo n.º 5
0
    def parse(self, response):

        pq = PyQuery(response.body_as_unicode())

        item = HowardBirnbaumItem()
        address = 0
        state = 0
        country = 0
        phone = 0
        web = 0
        email = 0
        city = 0
        postal = 0

        t = 1
        for i in pq('[class="dl-horizontal"] dt'):

            if 'Address' == i.text:
                address = t
            if 'City' in i.text:
                city = t
            if 'State' in i.text:
                state = t
            if 'Zip' in i.text:
                postal = t
            if 'Country' in i.text:
                country = t
            if 'Phone' in i.text:
                phone = t
            if 'Email' in i.text:
                email = t
            if 'Web Site' in i.text:
                web = t

            t += 1

        try:
            item['company'] = pq('[id="ORGNAME"]').text()
        except Exception as e:
            print(e)
        try:
            item['address'] = pq(
                '[class="dl-horizontal"] dd:nth-of-type({})'.format(
                    address)).text()
        except Exception as e:
            print(e)
        try:
            item['state'] = pq(
                '[class="dl-horizontal"] dd:nth-of-type({})'.format(
                    state)).text()
        except Exception as e:
            print(e)
        try:
            item['country'] = pq(
                '[class="dl-horizontal"] dd:nth-of-type({})'.format(
                    country)).text()
        except Exception as e:
            print(e)
        try:
            item['phone_number'] = pq(
                '[class="dl-horizontal"] dd:nth-of-type({})'.format(
                    phone)).text()
        except Exception as e:
            print(e)
        try:
            item['web_site_url'] = pq(
                '[class="dl-horizontal"] dd:nth-of-type({})'.format(
                    web)).text()
        except Exception as e:
            print(e)
        try:
            item['email'] = pq(
                '[class="dl-horizontal"] dd:nth-of-type({})'.format(
                    email)).text()
        except Exception as e:
            print(e)
        try:
            item['city'] = pq(
                '[class="dl-horizontal"] dd:nth-of-type({})'.format(
                    city)).text()
        except Exception as e:
            print(e)
        try:
            item['postal_code'] = pq(
                '[class="dl-horizontal"] dd:nth-of-type({})'.format(
                    postal)).text()
        except Exception as e:
            print(e)

        yield item
Exemplo n.º 6
0
    def parse(self, response):

        pq = PyQuery(response.body_as_unicode())

        item = HowardBirnbaumItem()
        company = ''
        address = ''
        state = ''
        country = ''
        phone_number = ''
        website = ''
        email = ''
        city = ''
        postal_code = ''
        for i in pq('table tr'):
            print(pq(i)('th').text())
            if 'Business Name' in pq(i)('th').text():
                company = pq(i)('td').text()
            if 'Address 1' in pq(i)('th').text():
                address = pq(i)('td').text()
            if 'State' in pq(i)('th').text():
                state = pq(i)('td').text()
            if 'Phone' in pq(i)('th').text():
                phone_number = pq(i)('td').text()
            if 'Website' in pq(i)('th').text():
                website = pq(i)('td').text()
            if 'City' in pq(i)('th').text():
                city = pq(i)('td').text()

            if 'Postal Code' in pq(i)('th').text():
                postal_code = pq(i)('td').text()

        try:
            item['company'] = company
        except Exception as e:
            print(e)
        try:
            item['address'] = address
        except Exception as e:
            print(e)
        try:
            item['state'] = state
        except Exception as e:
            print(e)
        try:
            item['country'] = country
        except Exception as e:
            print(e)
        try:
            item['phone_number'] = phone_number
        except Exception as e:
            print(e)
        try:
            item['web_site_url'] = website
        except Exception as e:
            print(e)
        try:
            item['email'] = email
        except Exception as e:
            print(e)
        try:
            item['city'] = city
        except Exception as e:
            print(e)
        try:
            item['postal_code'] = postal_code
        except Exception as e:
            print(e)

        yield item