import urllib.request as req
from bs4 import BeautifulSoup
import requests
import os
import time
import threading
# from multiprocessing import Pool
class PPT():
"""
整个的爬虫类
"""
def __init__(self):
self.baseUrl = "http://www.ypppt.com/moban/"
self.header = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36'}
self.num = 0
self.page_count = 0
def getResponseContent(self, url):
"""
获取页面请求信息
"""
try:
req_str = req.Request(url, headers=self.header)
response = req.urlopen(req_str, timeout = 10)
except Exception as e:
print(e)
print("请求失败")
else:
return response.read().decode("utf-8")
def getPageInfo(self, url):
"""
获取页面数量
"""
html = self.getResponseContent(url
利用Python下载PPT模板
最新推荐文章于 2024-07-11 11:09:03 发布
本文介绍如何利用Python脚本从网络资源中高效地下载高质量的PPT模板,通过自动化处理节省时间,提升工作效率。教程涵盖网络请求、文件保存及实战案例解析。
摘要由CSDN通过智能技术生成