Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
56 lines (29 sloc) 1.33 KB

Scraper

Easily fetch, slice, dice, and output HTML content from remote pages.

Lovingly crafted by Top Shelf Craft
Michael Rog, Proprietor


tl;dr

Scraper allows you to easily fetch HTML content from any URL, create a DOM with it, select elements by CSS selector, find and manipulate DOM nodes, and save or output them using the power of Twig templates.

Usage

Use Scraper to query content from remote URLs, select it by HTML and CSS selector, and output it in your Craft templates.

For example:

{% set acmeContent = craft.scraper.get("http://acmewidgets.com") %}
{% for widgets in acmeContent.find(".widget") %}
        <div>{{ widget.innerText }}</div>
{% endfor %}

or...

{% set google = craft.scraper.get("http://google.com") %}
{% for link in google.find("a") %}
    <li>{{ link.attr.href }}</li>
{% endfor% }

What are the system requirements?

Craft 2.5+ and PHP 5.4+

I found a bug.

Nah...

I triple-checked. It's a bug.

Well, alright. Please open a GitHub Issue, submit a PR to the dev branch, or just email me to let me know.


Contributors: