当前位置:   article > 正文

python 爬虫 爬取当当网图书信息_爬取当当网python书籍用bs4爬

爬取当当网python书籍用bs4爬
初次系统的学习python,在学习完基本语法后,对爬虫进行学习,现在对当当网进行爬取,爬取了基本图书信息,包括图书名、作者等
  1. import requests
  2. from time import sleep
  3. from lxml import etree
  4. class dangdang_spider():
  5. #定义爬虫类
  6. def __init__(self):
  7. self.url="http://category.dangdang.com/pg{}-cp01.00.00.00.00.00.html" #爬虫网址
  8. self.headers= {#设置headers
  9. 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) Ap
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号