array(
'name' => 'Tag to search',
'exampleValue' => 'example',
'required' => true
),
));
public function collectData(){
$html = getContents(static::URI . 'search.php?word=' . urlencode($this->getInput('tag')))
or returnClientError('Unable to query pixiv.net');
$regex = '/getTimestamp();
$item['content'] = "";
$this->items[] = $item;
}
}
private function cacheImage($url, $illustId) {
$url = str_replace('_master1200', '', $url);
$url = str_replace('c/240x240/img-master/', 'img-original/', $url);
$path = CACHE_DIR . '/pixiv_img';
if(!is_dir($path))
mkdir($path, 0755, true);
if(!is_file($path . '/' . $illustId . '.jpeg')) {
$headers = array('Referer: https://www.pixiv.net/member_illust.php?mode=medium&illust_id=' . $illustId);
$illust = getContents($url, $headers);
if(strpos($illust, '404 Not Found') !== false) {
$illust = getContents(str_replace('jpg', 'png', $url), $headers);
}
file_put_contents($path . '/' . $illustId . '.jpeg', $illust);
}
return 'cache/pixiv_img/' . $illustId . '.jpeg';
}
}