Skip to content

dataflowkitvsgoutte

BSD-3-Clause 4 3 716
Feb 09 2017 2026-11-10(2026-11-10 11:36:17 ago)
9,168 2 137 MIT
Dec 02 2012 8.5 thousand (month) v4.0.3(2023-04-01 09:05:33 ago)

Dataflow kit ("DFK") is a Web Scraping framework for Gophers. It extracts data from web pages, following the specified CSS Selectors. You can use it in many ways for data mining, data processing or archiving.

Web-scraping pipeline consists of 3 general components:

  • Downloading an HTML web-page. (Fetch Service)
  • Parsing an HTML page and retrieving data we're interested in (Parse Service)
  • Encoding parsed data to CSV, MS Excel, JSON, JSON Lines or XML format.

For fetching dataflowkit has several types of page fetchers:

  • Base fetcher uses standard golang http client to fetch pages as is. It works faster than Chrome fetcher. But Base fetcher cannot render dynamic javascript driven web pages.
  • Chrome fetcher is intended for rendering dynamic javascript based content. It sends requests to Chrome running in headless mode.

For parsing dataflowkit extracts data from downloaded web page following the rules listed in configuration JSON file. Extracted data is returned in CSV, MS Excel, JSON or XML format.

Some dataflowkit features:

  • Scraping of JavaScript generated pages;
  • Data extraction from paginated websites;
  • Processing infinite scrolled pages.
  • Sсraping of websites behind login form;
  • Cookies and sessions handling;
  • Following links and detailed pages processing;
  • Managing delays between requests per domain;
  • Following robots.txt directives;
  • Saving intermediate data in Diskv or Mongodb. Storage interface is flexible enough to add more storage types easily;
  • Encode results to CSV, MS Excel, JSON(Lines), XML formats;
  • Dataflow kit is fast. It takes about 4-6 seconds to fetch and then parse 50 pages.
  • Dataflow kit is suitable to process quite large volumes of data. Our tests show the time needed to parse appr. 4 millions of pages is about 7 hours.

Goutte is a screen scraping and web crawling library for PHP built on top of Symfony components (HttpClient, DomCrawler, BrowserKit). It provides a simple, elegant API for navigating websites, submitting forms, and extracting data.

Note: Goutte is deprecated as of 2023. Its functionality has been merged into Symfony's HttpBrowser component. For new projects, use Symfony HttpClient with DomCrawler directly. Goutte is still included here because it remains widely used in existing codebases and many tutorials reference it.

Key features include:

  • Simple scraping API Combines HTTP client and DOM crawler into a single interface. Navigate pages, click links, and extract content with a clean, chainable API.
  • CSS selector support Uses Symfony DomCrawler's filter() and each() methods with CSS selectors for extracting data from HTML.
  • Form handling Can find, fill in, and submit HTML forms. Handles all standard input types including file uploads.
  • Cookie management Automatically manages cookies across requests within a session.
  • Guzzle integration Uses Guzzle HTTP client under the hood for reliable HTTP communication with proxy support, authentication, and custom headers.
  • Link crawling Can follow links by text or CSS selector, making multi-page scraping straightforward.

For new PHP scraping projects, consider using Symfony HttpClient + DomCrawler directly, or the Roach framework for a more feature-complete solution.

Highlights


popularcss-selectors

Example Use


Dataflowkit uses JSON configuration like:
{
  "name": "collection",
  "request": {
      "url": "https://example.com"
  },
  "fields": [
      {
          "name": "Title",
          "selector": ".product-container a",
          "extractor": {
              "types": [
                  "text",
                  "href"
              ],
              "filters": [
                  "trim",
                  "lowerCase"
              ],
              "params": {
                  "includeIfEmpty": false
              }
          }
      },
      {
          "name": "Image",
          "selector": "#product-container img",
          "extractor": {
              "types": [
                  "alt",
                  "src",
                  "width",
                  "height"
              ],
              "filters": [
                  "trim",
                  "upperCase"
              ]
          }
      },
      {
          "name": "Buyinfo",
          "selector": ".buy-info",
          "extractor": {
              "types": [
                  "text"
              ],
              "params": {
                  "includeIfEmpty": false
              }
          }
      }
  ],
  "paginator": {
      "selector": ".next",
      "attr": "href",
      "maxPages": 3
  },
  "format": "json",
  "fetcherType": "chrome",
  "paginateResults": false
}
which is then ingested through CLI command.
<?php
require 'vendor/autoload.php';

use Goutte\Client;

$client = new Client();

// Navigate to a page
$crawler = $client->request('GET', 'https://example.com');
echo $crawler->filter('title')->text();

// Extract data using CSS selectors
$crawler->filter('.product')->each(function ($node) {
    $name = $node->filter('.name')->text();
    $price = $node->filter('.price')->text();
    echo "$name: $price\n";
});

// Click a link
$link = $crawler->selectLink('Next Page')->link();
$crawler = $client->click($link);

// Fill in and submit a form
$crawler = $client->request('GET', 'https://example.com/login');
$form = $crawler->selectButton('Login')->form([
    'username' => 'user@example.com',
    'password' => 'password123',
]);
$crawler = $client->submit($form);

// Cookies are maintained automatically across requests
echo $crawler->filter('h1')->text(); // "Welcome back!"

Alternatives / Similar


Was this page helpful?