Пример #1
0
 public function __construct()
 {
     // 初始化爬虫
     $configs = Crawler::getCrawlerConfigs();
     $this->crawler = Boot::curl($configs);
     // 初始化分析器
     $this->analysis = Boot::analysis();
 }
Пример #2
0
 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);
 }
Пример #3
0
 private final function store()
 {
     // 爬虫数据的存储
     $tm = Boot::userStore();
     // 预处理存储数据
     $tm->store('INSERT IGNORE INTO users(username, createAt) VALUES(?, ?)');
     // 存
     $tm->store($this->dataArray);
 }
Пример #4
0
 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);
     }
 }
Пример #5
0
 public function analysisUserFollowers(string $data)
 {
     return Boot::userFollowersAnalysis()->analysis($data);
 }
Пример #6
0
 protected function __construct()
 {
     $this->db = Boot::DB();
 }
Пример #7
0
 public static function getDetailAction() : null
 {
     Boot::detailInfoGetController()->getDetails();
 }
Пример #8
0
 public function saveConfig($times, $id)
 {
     $fileSave = Boot::fileCache('lastTimes.txt');
     $fileSave->saveConfig($times, $id);
     unset($fileSave);
 }
Пример #9
0
 protected function getLastTimesAndId()
 {
     $times = Boot::fileCache('lastTimes.txt');
     return $times->getConfig();
 }