Actor picture

Sunwarrior Scraper

mshopik/sunwarrior-scraper

Scrape Sunwarrior and extract data on vitamins and supplements from sunwarrior.com. Our Sunwarrior API lets you crawl product information and pricing. The saved data can be downloaded as HTML, JSON, CSV, Excel, and XML.

No credit card required

Author's avatarMark Carter
  • Modified
  • Users1
  • Runs187
Actor picture
Sunwarrior Scraper

INPUT_SCHEMA.json

{
    "title": "sunwarrior-scraper",
    "description": "",
    "type": "object",
    "schemaVersion": 1,
    "properties": {
        "proxyConfig": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "It's required to use proxies when running on the platform.",
            "prefill": {
                "useApifyProxy": true
            },
            "default": {
                "useApifyProxy": true
            },
            "editor": "proxy"
        },
        "maxRequestsPerCrawl": {
            "title": "Max items",
            "description": "How many items to extract from sunwarrior.com",
            "default": 0,
            "prefill": 100,
            "type": "integer",
            "editor": "number"
        },
        "extendOutputFunction": {
            "title": "Extend Output Function",
            "description": "Add or remove properties on the output object or omit the output returning null",
            "type": "string",
            "default": "async ({ data, item, product, images, fns, name, request, variants, context, customData, input, Apify }) => {\n  return item;\n}",
            "prefill": "async ({ data, item, product, images, fns, name, request, variants, context, customData, input, Apify }) => {\n  return item;\n}",
            "editor": "javascript",
            "sectionCaption": "Extend scraper functionality",
            "sectionDescription": "You can change the output of the items for your dataset here, or add additional behavior on the scraper."
        },
        "extendScraperFunction": {
            "title": "Extend Scraper Function",
            "description": "Advanced function that allows you to extend the default scraper functionality, allowing you to manually perform actions on the page",
            "type": "string",
            "default": "async ({ fns, customData, Apify, label }) => {\n \n}",
            "prefill": "async ({ fns, customData, Apify, label }) => {\n \n}",
            "editor": "javascript"
        },
        "customData": {
            "title": "Custom data",
            "description": "Any data that you want to have available inside the Extend Output/Scraper Function",
            "default": {},
            "prefill": {},
            "type": "object",
            "editor": "json"
        },
        "fetchHtml": {
            "title": "Fetch HTML",
            "description": "If you decide to fetch the HTML of the pages, it will take twice as long. Make sure to only enable this if needed",
            "default": true,
            "editor": "checkbox",
            "type": "boolean"
        },
        "maxConcurrency": {
            "title": "Max concurrency",
            "description": "Max concurrency to use",
            "default": 20,
            "prefill": 20,
            "type": "integer",
            "editor": "number"
        },
        "maxRequestRetries": {
            "title": "Max request retries",
            "description": "Set the max request retries",
            "default": 3,
            "prefill": 3,
            "type": "integer",
            "editor": "number"
        },
        "debugLog": {
            "title": "Debug Log",
            "description": "Enable a more verbose logging to be able to understand what's happening during the scraping",
            "type": "boolean",
            "default": false,
            "editor": "checkbox"
        }
    },
    "required": [
        "proxyConfig"
    ]
}

README.md

## What does Sunwarrior Scraper do?

This scraper creates an API for Sunwarrior to enable you to extract product information and pricing from the [sunwarrior.com](https://sunwarrior.com) online store. 

The Sunwarrior API is free to use and will let you scrape and extract e-commerce data as often as you need to. The data you extract can be downloaded in structured format so that you can use it in your own applications, spreadsheets, reports, or tools.

Scraping Sunwarrior could help you identify competition, opportunities, potential leads, and useful contacts. The right data can help you with product tracking, market research, and price monitoring in the vitamins and supplements category.

If you need more inspiration, check out [how scraping can help you](https://apify.com/industries/ecommerce-and-retail) get an edge over the competition and stay ahead in e-commerce.

## How much will it cost to scrape Sunwarrior?

Running Sunwarrior Scraper will consume platform credits. Platform credits are counted in USD and each plan includes a set amount. Check our [platform pricing](https://apify.com/pricing/actors) page for details.

The exact number of platform credits consumed will depend on the actor input settings, the type of job it performs, how often it runs, and for how long.

The best way to find out how many platform credits an actor will consume is to perform a test run. You can then review platform usage in [Billing](https://console.apify.com/billing) and figure out the best Apify subscription plan for your needs.

## How to scrape Sunwarrior

[sunwarrior.com](https://sunwarrior.com) is built using Shopify and Sunwarrior Scraper is one of our huge range of online e-commerce scrapers designed to create a universal Shopify API.

Check out our [quick start guide](https://docs.apify.com/tutorials/quick-start) to using any Apify scraper or feel free to send an email to [support@apify.com](mailto:support@apify.com) if you have any questions.

You can also watch our [video about scraping Amazon](https://www.youtube.com/watch?v=BsidLZKdYWQ) to understand more about scraping e-commerce data and how it can help your business succeed.

For more ideas, read about our [top 5 web scraping tools to help you gather retail analytics](https://blog.apify.com/top-5-web-scraping-tools-gather-retail-analytics/).

main.js

import Apify from 'apify';

Apify.main(async () => {
    const input = await Apify.getInput();

    await Apify.metamorph('pocesar/shopify-scraper', {
        ...input,
        startUrls: [{
            url: 'http://www.sunwarrior.com',
        }],
    });
});

package.json

{
    "name": "sunwarrior-scraper",
    "version": "0.0.1",
    "type": "module",
    "dependencies": {
        "apify": "^2.2.2"
    },
    "scripts": {
        "start": "node main.js"
    }
}

Dockerfile

# First, specify the base Docker image. You can read more about
# the available images at https://sdk.apify.com/docs/guides/docker-images
# You can also use any other image from Docker Hub.
FROM apify/actor-node:16

# Second, copy just package.json and package-lock.json since those are the only
# files that affect "npm install" in the next step, to speed up the build.
COPY package*.json ./

# Install NPM packages, skip optional and development dependencies to
# keep the image small. Avoid logging too much and print the dependency
# tree for debugging
RUN npm --quiet set progress=false \
 && npm install --only=prod --no-optional \
 && echo "Installed NPM packages:" \
 && (npm list --all || true) \
 && echo "Node.js version:" \
 && node --version \
 && echo "NPM version:" \
 && npm --version

# Next, copy the remaining files and directories with the source code.
# Since we do this after NPM install, quick build will be really fast
# for most source file changes.
COPY . ./

ENV APIFY_DISABLE_OUTDATED_WARNING 1
ENV npm_config_loglevel=silent

# Optionally, specify how to launch the source code of your actor.
# By default, Apify's base Docker images define the CMD instruction
# that runs the Node.js source code using the command specified
# in the "scripts.start" section of the package.json file.
# In short, the instruction looks something like this:
#
# CMD npm start