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

推荐订阅源

美团技术团队
D
DataBreaches.Net
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Check Point Blog
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
IT之家
IT之家
月光博客
月光博客
U
Unit 42
K
Kaspersky official blog
T
Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
云风的 BLOG
云风的 BLOG
酷 壳 – CoolShell
酷 壳 – CoolShell
I
InfoQ
Engineering at Meta
Engineering at Meta
Recorded Future
Recorded Future
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security @ Cisco Blogs
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
Security Archives - TechRepublic
Security Archives - TechRepublic
Webroot Blog
Webroot Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Schneier on Security
S
Secure Thoughts
The Register - Security
The Register - Security
B
Blog RSS Feed
The Last Watchdog
The Last Watchdog
P
Palo Alto Networks Blog
爱范儿
爱范儿
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
L
LINUX DO - 热门话题
C
Cisco Blogs
Spread Privacy
Spread Privacy
F
Full Disclosure
博客园 - 聂微东
T
The Blog of Author Tim Ferriss

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