Browse Source

Merge pull request 'cookie更新' (#45) from wpd_setCookie into master

Reviewed-on: #45
pull/46/head
pengda 5 days ago
parent
commit
06f465d147
  1. 1
      config/define.php
  2. 16
      control/weibo.php
  3. 4
      model/mSpider.php

1
config/define.php

@ -49,6 +49,7 @@
define('WEIBO_IMG_URL', 'https://wx4.sinaimg.cn/mw690/%s.jpg');
define('_RC_WEIBO_LOGIN_COOKIE', 'rc_weibo_login_cookie');
define('WEIBO_LOGIN_COOKIE', '_2A25FMHeEDeRhGeFH41MV8ibNyjSIHXVmTPVMrDV8PUNbmtAYLWLlkW9NekLV22uXkAnuAlCngnjVjozSXR5mujv7');
define('WEIBO_DETAIL_URL', 'https://zhishiku.yizherenxin.cn/weibo/show_detail/wid/%s');

16
control/weibo.php

@ -110,4 +110,20 @@ class weibo extends publicBase {
public function show_detail() {
$this->view['wid'] = $this->get('wid') + 0;
}
public function ajax_update_cookie() {
$cookie = trim($this->get('cookie'));
$type = $this->get('type') + 0;
$obj = new mWeiboBehavior();
$robj = $obj->initRedis();
$robj->set(_RC_WEIBO_LOGIN_COOKIE, $cookie);
if($type == 0){
shell_exec("nohup /usr/bin/php /data1/www/zhishiku.yizherenxin.cn/queue/crontab/spider_behavior_data.php > /dev/null 2>&1 &");
$this->ajax_json(true, '设置成功');
}
shell_exec("nohup /usr/bin/php /data1/www/zhishiku.yizherenxin.cn/queue/crontab/spider_behavior_delta.php > /dev/null 2>&1 &");
$this->ajax_json(true, '设置成功');
}
}

4
model/mSpider.php

@ -267,7 +267,7 @@ class mSpider extends mBase {
$this->proxy_ip = $ipdata['ip'];
$this->proxy_port = $ipdata['port'];
$cookie = WEIBO_LOGIN_COOKIE;
$cookie = $rdobj->get(_RC_WEIBO_LOGIN_COOKIE);;
$url = "https://weibo.com/ajax/statuses/searchProfile?uid={$uid}&page={$page}&hasori=1";
$headers = array(
"Cookie: SUB={$cookie}",
@ -378,7 +378,7 @@ class mSpider extends mBase {
$this->proxy_ip = $ipdata['ip'];
$this->proxy_port = $ipdata['port'];
$cookie = WEIBO_LOGIN_COOKIE;
$cookie = $rdobj->get(_RC_WEIBO_LOGIN_COOKIE);;
$endtime = strtotime("tomorrow");
$url = "https://weibo.com/ajax/statuses/searchProfile?uid={$uid}&page={$page}&endtime={$endtime}&hasret=1&hastext=1&haspic=1&hasvideo=1&hasmusic=1";
$headers = array(

Loading…
Cancel
Save