加入downloader下载器

This commit is contained in:
2026-06-10 15:00:08 +08:00
parent ce5adbd55c
commit 0cc012bb19
3 changed files with 18 additions and 5 deletions
+11
View File
@@ -0,0 +1,11 @@
import requests
class Downloader:
def __init__(self):
pass
def download(self,url):
response = requests.get(url)
print(response)
+4 -3
View File
@@ -1,9 +1,10 @@
from baid_spider.core.downloader import Downloader
class Engine:
def __init__(self):
pass
self.downloader = Downloader()
def start_spider(self,spider):
spider.start_requests()
start_url = spider.start_requests()
self.downloader.download(start_url)
+3 -2
View File
@@ -7,9 +7,10 @@ class Baidu_Spider:
def start_requests(self):
response = requests.get(self.start_urls)
print(response)
# response = requests.get(self.start_urls)
# print(response)
return self.start_urls
if __name__ == '__main__':
#初始化请求