加入downloader下载器
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import requests
|
||||
|
||||
|
||||
class Downloader:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def download(self,url):
|
||||
response = requests.get(url)
|
||||
print(response)
|
||||
@@ -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)
|
||||
|
||||
@@ -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__':
|
||||
#初始化请求
|
||||
|
||||
Reference in New Issue
Block a user