How to use WP Web Scraper?

WP Web Scraper lets you specify a URL source and a query to fetch specific content from it. WP Web Scraper can be used through a shortcode (for posts, pages or sidebar) or template tag (for direct integration in your theme) for scraping and displaying web content. Here’s the actual usage detail:

In shortcode:

[wpws url="https://www.yahoo.com/" query="ol.trendingnow_trend-list" output="text"]

In template tag:

<?php echo wpws_get_content("https://www.yahoo.com/", "ol.trendingnow_trend-list", array('output' => 'text')); ?>

The above shortcode and template tag would output the content of the CSS Selector ‘ol.trendingnow_trend-list’ from URL ‘https://www.yahoo.com/’ in your post, page or sidebar as plain text (HTML striped). Browse through more such examples to understand this better.

In case of template tag (wpws_get_content), the first argument is URL, the second argument is query while the third argument is a associative array with all other arguments.

WP Web Scraper has a host of options to control your URL request, do advanced parsing and managing output. Apart from CSS Selectors, WP Web Scraper also supports XPath and Regex queries.

8 thoughts on “How to use WP Web Scraper?

Leave a Reply