zoukankan      html  css  js  c++  java
  • Python实现 下载IJCAI会议所有论文

    原文链接:http://www.one2know.cn/python10/

    import requests
    import threading
    
    def get_file_content(num):
        savepath = '%04d.pdf' % (num)
        suburl = 'https://www.ijcai.org/proceedings/2018/%04d.pdf' % (num)
        r = requests.get(suburl)
        f = open(savepath,'wb') # 用'wb'读取非文本文件pdf
        f.write(r.content) # r.content -> requests中的二进制响应内容:以字节的方式访问请求响应体,对于非文本请求
        f.close()
    
    def get_file_content_arange(min,max):
        for num in range(min,max+1):
            print('doanloading %04d.pdf...' % (num))
            get_file_content(num)
    
    threads = []
    t1 = threading.Thread(target=get_file_content_arange,args=(1,221))
    threads.append(t1)
    t2 = threading.Thread(target=get_file_content_arange, args=(221,440))
    threads.append(t2)
    t3 = threading.Thread(target=get_file_content_arange, args=(440,658))
    threads.append(t3)
    t4 = threading.Thread(target=get_file_content_arange, args=(658,870,))
    threads.append(t4)
    for t in threads:
        t.start()
    
  • 相关阅读:
    flask强大的三方组件flask-Migrate
    FTP和HTTP
    MD5-JS加密
    使用websocket实现单聊和多聊
    Flask上下文管理
    python中的with用法
    如何判断一个对象是可调用对象
    缓存
    websocket与http
    csrf
  • 原文地址:https://www.cnblogs.com/peng8098/p/11163188.html
Copyright © 2011-2022 走看看