zoukankan      html  css  js  c++  java
  • python 黑板课爬虫闯关-第二关

    #!/usr/bin/python
    # -*- coding:utf-8 -*-
    # Author: LiTianle
    # Time:2019/9/24 15:36
    '''
    <h3>你需要在网址后输入数字53639</h3>
    <h3>下一个你需要输入的数字是10963. </h3>
    '''
    import requests,re
    def main():
        url='http://www.heibanke.com/lesson/crawler_ex01/'
        headers={
            'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36',
        }
        data={'username':'litianle','password':1}
        ex='<h3>(.*)</h3>'
        for i in range(30):
            respone_page=requests.post(url=url,data={'username':'litianle','password':i}).text
            result=re.findall(ex,respone_page,re.S)[0]
            print(result,i)
            if '成功' in result:
                nex_url=re.findall('<a href="(.*)/"',respone_page,re.S)[0]
                print('下一关:'+'http://www.heibanke.com'+nex_url)
                break
    
    if __name__ == '__main__':
        main()
  • 相关阅读:
    hadoop2.3.0cdh5.0.2 升级到cdh5.7.0
    strace
    ganglia3.7.2,web3.7.1安装
    hadoop balancer
    linux-小命令
    Ceph 架构以及原理分析
    Ceph 文件存储
    Ceph 对象存储
    Ceph 块存储
    Ceph 集群搭建
  • 原文地址:https://www.cnblogs.com/tianleblog/p/11672690.html
Copyright © 2011-2022 走看看