采集笔趣阁小说详情页内容
2019-07-02 08:35
155 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/shanying1991/article/details/94428232
目标站地址:http://www.biquges.cc/b2922/
代码如下:
#coding=utf-8
import requests,re
class GetDes:
def gettitle(self,str):
“”"
获取小说标题
:param str:
:return:
“”"
get_title=re.compile(r’.*最新章节’)<br/>
title=get_title.findall(str)[0]<br/>
lis=re.split(r’[>\(]’,title)<br/>
title=lis[1]<br/>
return title
def getauthor(self,str): """ 获取小说作者 :param str: :return: """ get_author=re.compile(r'者:.*</p>') author=get_author.findall(str)[0] lis=re.split(r'[\:\<]',author) author=lis[1] # print(author) return author def getdesc(self,str): """ 获取小说简介 :param str: :return: """ get_desc=re.compile(r'description" content=".*\/\>') desc=get_desc.findall(str) print(desc) def getdes(self): """ 采集圣墟 :return: """ url='http://www.biquges.cc/b2922/' url_two='http://www.9kzww.com/shu12/' if requests.get(url).status_code==200: con=requests.get(url) #解决中文乱码问题 con.encoding='gbk' cont=con.text # title=self.gettitle(cont) # print(title) # author=self.getauthor(cont) # print(author) desc=self.getdesc(cont) print(desc) # print(cont) else: return ''
if name==“main”:
gd=GetDes()
gd.getdes()
相关文章推荐
- 基于lucene的案例开发:纵横小说阅读页采集
- php采集页面内容并自动转码
- 文件内容操作命令 cat、more、less、head、tail、wc、grep 命令详情
- php curl采集远程页面内容演示代码
- 使用phpQuery轻松采集网页内容
- 在phpcms中的内容详情页中,输出时间
- Python爬虫小说采集程序
- dede 采集文章内容中图片不显示的问题
- 防止网站内容被人小偷和采集的ASP代码
- 防止网站内容被采集
- ecshop首页调用商品详情或者其他商品内容
- DEDECMS采集规则,过滤,替换文章内的部分内容
- MVC-内容详情页显示内容
- 防止网站内容被人小偷和采集的ASP代码
- BASH PS1 内容详情
- dedecms5.6采集如何过滤title中的内容
- 简单易用粗暴的文章内容采集程序 -【开源项目】
- 使用phpQuery轻松采集网页内容
- 批量采集上百万网页内容-php采集网页-php爬虫视频教程6
- 使用python3.6爬取笔趣阁的小说