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

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
The Register - Security
The Register - Security
量子位
Security Latest
Security Latest
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
MyScale Blog
MyScale Blog
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
Jina AI
Jina AI
博客园 - 【当耐特】
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
GRAHAM CLULEY
宝玉的分享
宝玉的分享
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
有赞技术团队
有赞技术团队
T
Tor Project blog
H
Hacker News: Front Page
A
Arctic Wolf
NISL@THU
NISL@THU
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
V
V2EX
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
I
InfoQ
D
Docker
L
LINUX DO - 最新话题
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42

龙辉'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