def download_html(self,html):
print('>>>>>>>>>>>>>>>>>>>>>>>>>正在下载网页源码>>>>>>>>>>>>>>>>>>>>>>>>>')
if not os.path.exists(self.spath+'/htmls'):
print(self.base_path+'/htmls', '已经将html文件存在对应目录')
os.system('mkdir -p %s' % self.spath+'/htmls')
else:
print(self.base_path+'/htmls', '已经存在此htmls目录')
if html:
with open('./%s' % (self.spath+'/htmls/'+self.spath+'.html'), 'w', encoding='utf-8') as f:
f.write(html)
print('===========================下载网页源码完毕===========================')
def gs_runner(self,html):
self.download_html(html)
self.download_imgs(html)
self.download_css(html)
self.download_js(html)
if __name__ == '__main__':
gs = GovSpider()
gs.start_page()
get
最新推荐文章于 2020-06-23 08:48:17 发布