当前位置:   article > 正文

python爬虫实践—纵横中文网免费小说爬取_纵横中文网python .exe

纵横中文网python .exe

python爬虫实践—纵横中文网免费小说爬取(仅供记录学习)

爬取初始页面链接: http://book.zongheng.com/store/c1/c0/b0/u0/p1/v9/s1/t0/u0/i1/ALL.html
.

https://imgconvert.csdnimg.cn/aHR0cHM6Ly9hdmF0YXIuY3Nkbi5uZXQvNy83L0IvMV9yYWxmX2h4MTYzY29tLmpwZw

python代码.

// An highlighted block
import requests
from lxml import etree
import re
import os,time

def getHtml(url):
	headers = {
   'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.36 Safari/537.36'}
	html = requests.get(url,headers = headers)
	return html.text

def getBookId(url):
	bookIdList = []
	text = getHtml(url)
	html = etree.HTML(text)
	bookUrlList 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/黑客灵魂/article/detail/752486
推荐阅读
相关标签
  

闽ICP备14008679号