使用cookie模拟登陆抽屉网并点赞

import requests
class ChouTiSpider(object):
    def __init__(self):
        self.headers={
            "User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:61.0) Gecko/20100101 Firefox/61.0",
            "Host":"dig.chouti.com",
            "Referer":"https://dig.chouti.com/",
            "Cookie":"gpsd=8592bb5eb2e83ea146f026e160540c99; gpid=437c296938de4d34a83e5751eb7a81f4; JSESSIONID=aaahwOSmVfudyc09u4Atw; puid=1f758e3acf0f7b13e5d0eb66fc7d2367; puid=cdu_52992983314"
        }
        self.proxy={"http":"http://117.102.70.195:8080"}
        self.session=requests.Session()

    #定义一个函数模拟登陆抽屉网
    def login(self):
        post_url="https://dig.chouti.com/login"
        data={
            "oneMonth":"1",
            "phone":"86自己的手机号",
            "password":"自己的密码"
        }
        response=self.session.post(post_url,proxies=self.proxy,data=data,headers=self.headers).json()
        print(response)

    #定义一个点赞的函数
    def dianzan(self):
        response=self.session.post("https://dig.chouti.com/link/vote?linksId=21522206",proxies=self.proxy,headers=self.headers).text
        print(response)


if __name__ == '__main__':
    spider=ChouTiSpider()
    spider.login()
    spider.dianzan()

 

转载于:https://www.cnblogs.com/chensang/p/10097443.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值