public function __construct() { // 初始化爬虫 $configs = Crawler::getCrawlerConfigs(); $this->crawler = Boot::curl($configs); // 初始化分析器 $this->analysis = Boot::analysis(); }
private final function store() { // 爬虫数据的存储 $tm = Boot::detailsStore(); // 预处理存储数据 $tm->store('INSERT IGNORE INTO informations(username, nickname, bio, location, business, gender, education, education_extra, content, agrees, thanks, blue_stars, following, followers) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); // 存 $tm->store($this->dataArray); }
private final function store() { // 爬虫数据的存储 $tm = Boot::userStore(); // 预处理存储数据 $tm->store('INSERT IGNORE INTO users(username, createAt) VALUES(?, ?)'); // 存 $tm->store($this->dataArray); }
protected function init() { // 获取redis实例 $this->redis = Boot::redis(); $this->db = Boot::DB(); // 从配置文件中获取最大limit并写入到redis中 $size = Crawler::getMaxLimit(); $this->redis->set('limitSize', $size); if (DEBUG == true) { echo 'the usernames at redis :'; var_dump($this->redis->llen('usernames')); } if (!$this->redis->llen('usernames')) { // 初始化数据 $this->getUsernames(0); } }
public function analysisUserFollowers(string $data) { return Boot::userFollowersAnalysis()->analysis($data); }
protected function __construct() { $this->db = Boot::DB(); }
public static function getDetailAction() : null { Boot::detailInfoGetController()->getDetails(); }
public function saveConfig($times, $id) { $fileSave = Boot::fileCache('lastTimes.txt'); $fileSave->saveConfig($times, $id); unset($fileSave); }
protected function getLastTimesAndId() { $times = Boot::fileCache('lastTimes.txt'); return $times->getConfig(); }