PHP code example of scribilicious / tinylistscraper

1. Go to this page and download the library: Download scribilicious/tinylistscraper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

scribilicious / tinylistscraper example snippets



ad all results from all the scrapers
$oScraper = new TinyListScraper\TinyListScraper();
$aResults = $oScraper->get('search some text');
print_r($aResults);

// Load just the results from verge
$aResults = $oScraper->get('search some text', array('verge'));
print_r($aResults);


$aSettings = array(
    'url' => 'https://techcrunch.com/search/{$SEARCH}',
    'source' => 'techcrunch.com',
    'list' => array(
        'container' => array(
            'selector' => '//div[contains(@class,"post-block post-block")]'
        ),
        'link' => array(
            'selector' => './/a[contains(@class,"post-block__title__link")]',
            'attribute' => 'href'
        )
    ),
    'content' => array(
        'title' => array(
            'selector' => './/meta[@name="sailthru.title"]',
            'attribute' => 'content'
        ),
        'author' => array(
            'selector' => './/meta[@name="sailthru.author"]',
            'attribute' => 'content'
        ),
        'date' => array(
            'selector' => './/meta[@name="sailthru.date"]',
            'attribute' => 'content'
        ),
        'description' => array(
            'selector' => './/meta[@property="og:description"]',
            'attribute' => 'content'
        ),
        'tags' => array(
            'selector' => './/meta[@name="sailthru.tags"]',
            'attribute' => 'content'
        ),
        'image' => array(
            'selector' => './/meta[@name="sailthru.image.full"]',
            'attribute' => 'content'
        ),
        'thumb' => array(
            'selector' => './/meta[@name="sailthru.image.thumb"]',
            'attribute' => 'content'
        ),
        'text' => array(
            'selector' => './/div[contains(@class,"article-content")]/p'
        )
    )
);