PHP code example of revolution / niconico

1. Go to this page and download the library: Download revolution/niconico 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/ */

    

revolution / niconico example snippets



use Revolution\Niconico\Search;
use Revolution\Niconico\Search\Query;

$query = new Query();
$query->q = "初音ミク";
$query->targets = 'title,tags';
$query->_sort = "-viewCounter";
$query->filters(['filters[mylistCounter][gte]=10000', 'filters[commentCounter][gte]=100000']);

$search = new Search();

// returns object
$response = $search->search($query);

// returns array
$response = $search->search($query, true);


use Revolution\Niconico\Search\Query;

$query = new Query([
  'q'        => '初音ミク',
  'targets'  => 'title,tags',
  '_sort'    => '-viewCounter',
]);


use Revolution\Niconico\Search\Query;

$query = Query::create([
  'q'        => '初音ミク',
  'targets'  => 'title,tags',
  '_sort'    => '-viewCounter',
])->filters([]);


use Revolution\Niconico\ThumbInfo;

$thumb = new ThumbInfo();

$thumb->get('sm9');

var_dump($thumb->video_id);//'sm9'

var_dump($thumb->toJson());
var_dump($thumb->toArray());
var_dump($thumb->toSimpleObject());


use Revolution\Niconico\ThumbInfo;

$thumb = new ThumbInfo('sm9');

$search = new Search();
$search->endpoint = 'http...';