Mikhail Sisin Co-founder of cloud-based web scraping and data extraction platform Diggernaut. Over 10 years of experience in data extraction, ETL, AI, and ML.

Extract product and price information from American Apparel online store

6 min read

Extract product and price information from American Apparel online store

American Apparel is a North American manufacturer and fashion apparel retailer based in Los Angeles, California. The company was founded in 1989 by Canadian businessman Dov Charny. The scraper presented in this article will allow you to extract product and price information presented in the online store of the company: americanapparel.net.

Approx number of goods: 500
Approx number of page requests: 500
Recommended subscription plan: Free

PLEASE NOTE! The number of requests can exceed the number of products, because data about variations, images, etc. can be scraped from other resources and will require additional requests. Also part of the product data can be delivered using XHR requests, which also increases the total number of required page requests.

How to use the web scraper to extract product and price information from americanapparel.net

To use the web scraper for American Apparel online store’s website, you must have an account with our Diggernaut service. You can just simply follow this comprehensive guide:

  1. Go through this registration link to open free account with Diggernaut
  2. After registering and confirming the email address, you will need to log in to your account
  3. Create a project with any name and description, if you do not know how to do it, please refer to our documentation
  4. Switch to the created project and create a digger with any name, if you do not know how to do it, please refer to our documentation
  5. Copy the following digger configuration to the clipboard and paste it into the digger you created, if you do not know how to do it, refer to our documentation
  6. Switch the mode of the digger from Debug to Active, if you do not know how to do it, please refer to our documentation
  7. Run your digger and wait until the completion, if you do not know how to do it, please refer to our documentation
  8. Download the scraped dataset in the format you need, if you do not know how to do it, please refer to our documentation

You can also setup a schedule for running your scraper and collect data regularly.

Scraping configuration for the digger

---
config: 
    debug: 2
    agent: Firefox
do:
- link_add:
    url: http://store.americanapparel.net
- link_add:
    url: http://store.americanapparel.net/en/factory-store/
- walk:
    to: links
    do:
    - find:
        path: .cd-primary-nav a
        do:
        - parse:
            attr: href
        - normalize:
            routine: url
        - link_add:
            pool: main
- walk:
    to: links
    pool: main
    do:
    - find:
        path: .product > a
        do: 
        - parse:
            attr: href
        - normalize:
            routine: url
        - link_add:
            pool: sub
- walk:
    to: links
    pool: sub
    do:
    - sleep: 3
    - find:
        path: .pdp
        do:
        - variable_clear: allli
        - variable_clear: descr
        - variable_clear: li
        - variable_clear: id
        - variable_clear: views
        - variable_clear: color
        - variable_clear: imgnum
        - variable_clear: imgxl
        - variable_clear: viewsnum
        - variable_clear: stp
        - object_new: product
        - eval:
            routine: js
            body: '(function (){var d = new Date(); return d.toISOString()})();'
        - object_field_set:
            object: product
            field: date
        - static_get: url
        - object_field_set:
            object: product
            field: url
        - find: 
            in: doc
            path: head meta[name="description"] 
            do: 
            - parse:
                attr: content
            - space_dedupe
            - trim
            - to_block
            - node_replace:
                path: br
                with: "\n"
            - split:
                context: text
                delimiter: \n+
            - find:
                path: div.splitted
                slice: 0
                do:
                - parse
                - space_dedupe
                - trim
                - object_field_set: 
                    object: product
                    field: description
        - find:
            path: .product-style
            do:
            - parse
            - space_dedupe
            - trim
            - object_field_set: 
                object: product
                field: sku
        - find:
            path: .price
            do:
            - find:
                path: .red-text
                do:
                - parse:
                    filter:
                        - (\d+\.?\d*)
                - if:
                    match: (\d)
                    do:
                    - object_field_set:
                        object: product
                        field: price
                        type: float
                    - register_set: USD
                    - object_field_set:
                        object: product
                        field: currency
                    - register_set: 1
                    - variable_set: stp
            - find:
                path: span[data-test="test"]
                do:
                - variable_get: stp
                - if:
                    match: (1)
                    else:
                    - parse:
                        filter:
                            - (\d+\.?\d*)
                    - if:
                        match: (\d)
                        do:
                        - object_field_set:
                            object: product
                            field: price
                            type: float
                        - register_set: USD
                        - object_field_set:
                            object: product
                            field: currency
        - find:
            path: .product-name
            do:
            - parse
            - space_dedupe
            - trim
            - object_field_set: 
                object: product
                field: name
        - find:
            path: .main-img
            do:
            - parse:
                attr: src
            - object_field_set:
                object: product
                field: images
                joinby: "|"
        - find:
            path: .logo
            slice: 0
            do:
            - parse
            - space_dedupe
            - trim
            - object_field_set: 
                object: product
                field: brand
        - find:
            path: .breadcrumbs a
            do:
            - parse
            - space_dedupe
            - trim
            - object_field_set: 
                object: product
                field: category
                joinby: "|"
        - find:
            path: '.product-details > input#skuVarData'
            do:
            - parse:
                attr: value
            - normalize:
                routine: replace_substring
                args:
                    \s+\/\s+: _
            - normalize:
                routine: json2xml
            - to_block
            - find:
                path: body_safe > name
                do:
                - parse
                - space_dedupe
                - trim
                - object_field_set:
                    object: product
                    field: name
            - find:
                path: colors
                do:
                - find:
                    path: zoomimage
                    do:
                    - parse:
                        filter:
                            - \s*(.+)\?
                    - variable_set: imgxl
                    - register_set: <%imgxl%>?$ProductZoom$
                    - object_field_set:
                        object: product
                        field: images
                        joinby: "|"
                - find:
                    path: name
                    do:
                    - parse
                    - space_dedupe
                    - trim
                    - object_field_set:
                        object: product
                        field: variations
                        joinby: "|"
        - object_save:
            name: product

Sample of scraped data

Below is a sample of a dataset with several products in JSON format (so you can easily review it and see data structure). The dataset can be downloaded as CSV, XLSX, XML, or any other text format using the templates.

[{
    "product": {
        "brand": "American Apparel ®",
        "category": "Women|Multipacks",
        "currency": "USD",
        "date": "2017-12-05T18:06:21.973Z",
        "description": "The 50/50 Crewneck T-Shirt is a super-soft Poly-Cotton t-shirt featuring a slightly scooped neck and perfectly worn feel.",
        "images": "http://s7d9.scene7.com/is/image/AmericanApparel/bb301w_white?defaultImage=/notavail&$ProductImage2.5$|http://s7d9.scene7.com/is/image/AmericanApparel/bb301w_white?defaultImage=/notavail&$ProductImage2.5$|http://s7d9.scene7.com/is/image/AmericanApparel/bb301w_asphalt?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb301w_black?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb301w_gold?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb301w_kellygreen?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb301w_navy?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb301w_orchid?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb301w_pink?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb301w_red?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb301w_truffle?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb301w_white?$ProductZoom$",
        "name": "50/50 Crewneck T-Shirt",
        "price": 18,
        "sku": "bb301w",
        "url": "http://www.americanapparel.com/en/50-50-crewneck-t-shirt_bb301w?c=White",
        "variations": "Asphalt|Black|Gold|Kelly Green|Navy|Orchid|Pink|Red|Truffle|White"
    }
}
,{
    "product": {
        "brand": "American Apparel ®",
        "category": "Women|T-Shirts & Tanks|Tanks",
        "currency": "USD",
        "date": "2017-12-05T18:06:25.305Z",
        "description": "The 50/50 tank is a sexy tank with generously cut arm openings and a slim racerback in our super-soft Poly-Cotton fabric.",
        "images": "http://s7d9.scene7.com/is/image/AmericanApparel/bb308w_navy?defaultImage=/notavail&$ProductImage2.5$|http://s7d9.scene7.com/is/image/AmericanApparel/bb308w_navy?defaultImage=/notavail&$ProductImage2.5$|http://s7d9.scene7.com/is/image/AmericanApparel/bb308w_asphalt?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb308w_black?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb308w_gold?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb308w_kellygreen?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb308w_navy?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb308w_orchid?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb308w_pink?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb308w_red?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb308w_truffle?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/bb308w_white?$ProductZoom$",
        "name": "50/50 Tank",
        "price": 16,
        "sku": "bb308w",
        "url": "http://www.americanapparel.com/en/50-50-tank_bb308w?c=Navy",
        "variations": "Asphalt|Black|Gold|Kelly Green|Navy|Orchid|Pink|Red|Truffle|White"
    }
}
,{
    "product": {
        "brand": "American Apparel ®",
        "category": "Women|Basics Shop",
        "currency": "USD",
        "date": "2017-12-05T18:06:28.613Z",
        "description": "The 50/50 Loose Crop Tee is a loose-fitting cropped t-shirt in our ultra-soft 50/50 Poly-Cotton blend. Perfect for layering or paired with high-waist skirts, pants and shorts.",
        "images": "http://s7d9.scene7.com/is/image/AmericanApparel/rsabb380w_white?defaultImage=/notavail&$ProductImage2.5$|http://s7d9.scene7.com/is/image/AmericanApparel/rsabb380w_white?defaultImage=/notavail&$ProductImage2.5$|http://s7d9.scene7.com/is/image/AmericanApparel/rsabb380w_black?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/rsabb380w_navy?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/rsabb380w_orchid?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/rsabb380w_pink?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/rsabb380w_red?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/rsabb380w_white?$ProductZoom$",
        "name": "50/50 Loose Crop Tee",
        "price": 18,
        "sku": "rsabb380w",
        "url": "http://www.americanapparel.com/en/50-50-loose-crop-tee_rsabb380w?c=White",
        "variations": "Black|Navy|Orchid|Pink|Red|White"
    }
}
,{
    "product": {
        "brand": "American Apparel ®",
        "category": "Women|Multipacks",
        "currency": "USD",
        "date": "2017-12-05T18:06:31.899Z",
        "description": "The Tri-Blend Racerback Tank is a sexy tank with generously cut arm openings and a slim racerback in our ultra soft Tri-Blend fabric. • Polyester retains shape and elasticity; Cotton lends both comfort and durability; addition of Rayon makes for a unique texture and drapes against the body for a slimming look",
        "images": "http://s7d9.scene7.com/is/image/AmericanApparel/tr308w_tri-lieutenant?defaultImage=/notavail&$ProductImage2.5$|http://s7d9.scene7.com/is/image/AmericanApparel/tr308w_tri-lieutenant?defaultImage=/notavail&$ProductImage2.5$|http://s7d9.scene7.com/is/image/AmericanApparel/tr308w_athleticblue?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/tr308w_athleticgrey?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/tr308w_tri-black?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/tr308w_tri-creolepink?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/tr308w_tri-indigo?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/tr308w_tri-lieutenant?$ProductZoom$|http://s7d9.scene7.com/is/image/AmericanApparel/tr308w_tri-red?$ProductZoom$",
        "name": "Tri-Blend Racerback Tank",
        "price": 18,
        "sku": "tr308w",
        "url": "http://www.americanapparel.com/en/tri-blend-racerback-tank_tr308w?c=Tri-Lieutenant",
        "variations": "Athletic Blue|Athletic Grey|Tri-Black|Tri-Creole Pink|Tri-Indigo|Tri-Lieutenant|Tri-Red"
    }
}]
Mikhail Sisin Co-founder of cloud-based web scraping and data extraction platform Diggernaut. Over 10 years of experience in data extraction, ETL, AI, and ML.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.