惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tenable Blog
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
H
Help Net Security
F
Fortinet All Blogs
MyScale Blog
MyScale Blog
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 司徒正美
量子位
N
Netflix TechBlog - Medium
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
Recorded Future
Recorded Future
博客园 - 三生石上(FineUI控件)
Vercel News
Vercel News
aimingoo的专栏
aimingoo的专栏
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
Scott Helme
Scott Helme
The Last Watchdog
The Last Watchdog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
AI
AI
WordPress大学
WordPress大学
Security Archives - TechRepublic
Security Archives - TechRepublic
Google Online Security Blog
Google Online Security Blog
U
Unit 42
V2EX - 技术
V2EX - 技术
MongoDB | Blog
MongoDB | Blog
Schneier on Security
Schneier on Security
博客园 - Franky
H
Heimdal Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Jina AI
Jina AI
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Cloudbric
Cloudbric
B
Blog RSS Feed
N
News | PayPal Newsroom
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园_首页
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
雷峰网
雷峰网

龙辉's Blog - php

贵州师范大学抢课脚本-正方教务系统V8.0.0 - 龙辉's Blog 简单实现每日健康自动打卡 - 龙辉's Blog php获取客户端ip以及ip伪造 - 龙辉's Blog XSS经典漏洞复现-手撕某非法获取个人信息网站 - 龙辉's Blog php7.2中each()函数被弃用的替换办法 - 龙辉's Blog 云签网站问题反馈贴 - 龙辉's Blog 给网站接入QQ登录,无需申请QQ互联 - 龙辉's Blog ezsql-超级好用的操作类 - 龙辉's Blog php对称加密 - 龙辉's Blog
贴吧关注类-php - 龙辉's Blog
博主: Tinker-站长 · 2020-11-03 · via 龙辉's Blog - php
  • 发布时间:
  • 7995 次浏览
  • 3 条评论
  • 122字数
  • 分类: php
  1. 首页
  2. 正文  
  3. 分享到:

有人需要用很多个号来关注贴吧,或者一个号关注多个贴吧,很明显手工是很累的.所以写了一个php关注类,开源出来给大家.
因为大量的关注需要消耗服务器的资源,所以你也可以在我的网站使用
使用地址:http://tieba.eirds.cn/
    <?php
    
    /**
    *author : 一千零一夜-龙辉QQ1790716272
    *date:2020/03/28
    *description:贴吧关注类
    *parma: kw=需要关注的吧  bduss=登录贴吧之后的bduss
    *
    *
    */
    
    class tbkw{
            protected $kw = '';
            protected $bduss = '';
            protected $head = array(
                'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
    'Accept-Encoding: gzip, deflate, br',
    'Accept-Language: zh-CN,zh;q=0.9',
    'Cache-Control: max-age=0',
    'Connection: keep-alive',
        'Host: tieba.baidu.com',
    'Sec-Fetch-Dest: document',
    'Sec-Fetch-Mode: navigate',
    'Sec-Fetch-Site: none',
    'Sec-Fetch-User: ?1',
    'Upgrade-Insecure-Requests: 1',
    'User-Agent: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36',
                );
        public function __construct($kw=null,$bduss=null){
            
            $this->kw = urlencode($kw);
            $this->bduss =$bduss;
            
        }
        public function like(){
    $kwurl = 'https://tieba.baidu.com/mo/q/favolike?fid='.$this->fid().'&kw='.$this->kw.'&itb_tbs='.$this->tbs().'&uid='.$this->tbs();
    //$kwurl = 'https://tieba.baidu.com/mo/q/favolike?fid=16386&kw=%E6%81%8B%E7%88%B1&itb_tbs='.$this->tbs().'&uid='.$this->tbs();
      $result = $this->geturl($kwurl,$this->bduss,$this->head);
      $results = json_decode($result,true);
      
      if($results['no']==0){
          
          $data = '关注'.urldecode($this->kw).'吧成功';
          
      }elseif($results['no']==20001){
           $data = '参数不全';
           
      }else{
          
          $data = '出现了未知的错误';
      }
      return $data;
    
        }
        
        protected function fid(){
        
            $tbinfo = json_decode($this->geturl('http://tieba.baidu.com/f/commit/share/fnameShareApi?ie=utf-8&fname='.$this->kw),true);
            $fid = $tbinfo['data']['fid'];
            return $fid ;
        }
        protected function tbs(){
            $tbs = json_decode($this->geturl('http://tieba.baidu.com/dc/common/tbs',$this->bduss),true);
            
            return $tbs['tbs'];
        }
        
        protected function geturl($url,$bduss=null,$head=null){
                $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_HEADER, 0);            
            if(!is_null($bduss))curl_setopt($ch, CURLOPT_COOKIE , 'BDUSS='.$bduss);        
            if(!is_null($head))curl_setopt($ch, CURLOPT_HTTPHEADER, $head);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);        // 对认证证书来源的检查
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);        // 使用自动跳转
            curl_setopt($ch, CURLOPT_AUTOREFERER, 1);           // 自动设置Referer
            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);        // 设置等待时间
            curl_setopt($ch, CURLOPT_TIMEOUT, 1);              // 设置cURL允许执行的最长秒数
            $res = curl_exec($ch);
            curl_close($ch);
            return $res;
            }
    }    
    if($_GET['kw'] && $_GET['bduss']){
    $tbkw = new tbkw($_GET['kw'],$_GET['bduss']);
    
    print_r($tbkw->like());
    }elseif($_GET[‘bduss’]){
        $tbkw = new tbkw('云签到',$_GET['bduss']);
    
    print_r($tbkw->like());
    }
    /*代码编写完毕!就是如此简单——.——*/
?>


版权属于:龙辉博客

本文链接:https://blog.eirds.cn/317.html

如果没有特别声明则为本博原创。转载时须注明出处及本声明!

赞赏作者

如果觉得我的文章对你有用,请随意赞赏

贴吧关注类-php