Disclaimer: This is a user generated content submitted by a member of the WriteUpCafe Community. The views and writings here reflect that of the author and not of WriteUpCafe. If you have any complaints regarding this post kindly report it to us.

Web extracting is an efficient & faster way to acquire data of store sites for a specific website sooner grasping time to collect details by own. This blog is about Scrape Store Locations from Target.com contact details and store locations accessible on Target.com, which is a leading E-Commerce store in the USA.

Data Fields That Can Scraped

For this Blog, our extractor will scrape the data of store details by a specified zip code.

  • Name of Store
  • Store Address
  • Hours Open
  • Week Day
  • Phone Number
  • Pricing
  • Store Contact Number
  • Seller
  • Product Image
  • Product Image URL
  • Brand
  • Number of Reviews
  • Product Size
  • Description
  • Product ID
  • Product Variation
  • Rating Histogram
  • Customers Reviews
  • Online Availability Status
  • Store Availability Status

There are many data we can scrape from the store details page on Target like grocery & pharmacy timings, but as of now, we need to stick with these.

Extracting Logic

  • The explore outcome page utilizing Python Requests you need to Download HTML – if you have the URL. We utilize Python desires to load the complete HTML of the particular page.
  • Build URL of exploring outcome from Target.com. Let’s choose the location, New York. We will have to make this URL by own to extract outcome from that page. https://www.target.com/store-locator/find-stores?address=12901&capabilities=&concept=
  • Save the information to a JSON format.

Necessities

There are Web extracting blogs that utilize Python 3, we require some correspondences for parsing & downloading the HTML. Here are some of the correspondence.

Install Python 3 and Pip

You have this guidebook, how you can mount Python 3 in Linux–
http://docs.python-guide.org/en/latest/starting/install3/linux/

Mac operator can also use thig guidebook –
http://docs.python-guide.org/en/latest/starting/install3/osx/

Windows operators can click here – https://realpython.com/installing-python/

Install Packages

If you like the code, then you need to check the below-given link for Python 2.7 here.

Running the Extractor

Suppose the extractor is called target.py. Once you type name in prompt command laterally with a -h

usage: target.py [-h] zipcode
positional arguments:
zipcode Zipcode

optional arguments:
-h, –help show this help message and exit

The zip code is to discover the warehouse nearby a specific location.

In case, you find the entire Target warehouse in and nearby New-York we will put the zip code as 12901:

python target.py 12901

This will generate a JSON productivity file name 12901-locations. json will remain in a similar file like a script.

The output folder will look comparable to this.

{
        “County”: “Clinton”,
        “Store_Name”: “Plattsburgh”,
        “State”: “NY”,
        “Street”: “60 Smithfield Blvd”,
        “Stores_Open”: [
            “Monday-Friday”,
            “Saturday”,
            “Sunday”
        ],
        “Contact”: “(518) 247-4961”,
        “City”: “Plattsburgh”,
        “Country”: “United States”,
        “Zipcode”: “12901-2151”,
        “Timings”: [
            {
                “Week Day”: “Monday-Friday”,
                “Open Hours”: “8:00 a.m.-10:00 p.m.”
            },
            {
                “Week Day”: “Saturday”,
                “Open Hours”: “8:00 a.m.-10:00 p.m.”
            },
            {
                “Week Day”: “Sunday”,
                “Open Hours”: “8:00 a.m.-9:00 p.m.”
            }
        ]
    }

You can download the given below code at

Limitations

This code will work for scraping information of Target warehouse for entire zip codes accessible at Target. If you need to extract the information of millions of pages you need to read.

If you want expert help for extracting compound websites, contact Web Screen Scraping for all your queries

Login

Welcome to WriteUpCafe Community

Join our community to engage with fellow bloggers and increase the visibility of your blog.
Join WriteUpCafe