python爬取晋江_爬虫爬取晋江文学网总分榜
一、目的 :
爬取晋江文学网总分榜
二、python爬取数据
三、爬取
在开始多出现了38号而且顺序内容不准确
代码:
import requests
from bs4 import BeautifulSoup
import bs4
url="http://www.jjwxc.net/topten.php?orderstr=7&t=0"
def getHtml(url):
r=requests.get(url)
r.raise_for_status()
r.encoding=r.apparent_encoding
return r.text[26000:100000]
def fillList(html):
l1,l2 = [],[]
soup = BeautifulSoup(html,"html.parser")
for i in soup.find_all('a',"tooltip"):
l1.append(str(i.string))
for tag in soup.find_all('td',{"align":"center"}):
s=str(tag.string)
s.replace(" "," ")
l2.append(s)
return l1,l2
def printList(l1,l2):
n1,n2 = len(l1),len(l2)
n=max(n1,n2)
for i in range(n):
print("第{}名:《{}》".format(i+1,l1[i]))
print("积分:{}".format(l2[i]))
print("")
def main():
html=getHtml(url)
l1,l2=fillList(html)
printList(l1,l2)
main()
这几类数据我分不开,绝望
百度了一下就发现
内容网址:https://www.cnblogs.com/wangyongfengxiaokeai/p/11869595.html
而且好像height=‘23’和alig前后位置不同对结果也有影响
又换了试就发现是红框的问题,但是红框内换了几次代码还是都不能完全分开,最后只有l2中为作品字数时可以完全带进去,但是字数在这里没有什么实际价值。
就只能做出排名
python爬取晋江_爬虫爬取晋江文学网总分榜相关推荐
- python爬取晋江_爬虫爬取晋江文学网总分榜(失败)
一.目的 : 爬取晋江文学网总分榜 二.python爬取数据 三.爬取 在开始多出现了38号而且顺序内容不准确 代码: import requests from bs4 import Beautifu ...
- python爬取王者_爬虫 抓取王者荣耀所有英雄皮肤高清壁纸+超强注释
[python]代码库import urllib.request import re # 获取主页源码 url = 'https://pvp.qq.com/web201605/herolist.sht ...
- python 下载图片损坏_爬虫爬取出的图片下载出错,图片文件直接损坏
import requests import os, sys, stat from lxml import etree import time class HuangMan(): def __init ...
- python代码手机壁纸_爬虫 抓取王者荣耀所有英雄皮肤高清壁纸+超强注
[python]代码库import urllib.request import re # 获取主页源码 url = 'https://pvp.qq.com/web201605/herolist.sht ...
- python高清壁纸_爬虫 抓取王者荣耀所有英雄皮肤高清壁纸(完美版本)
[python]代码库import urllib.request import json import os import re # 皮肤下载地址 skin_link = 'https://game. ...
- python 爬虫爬不出来_爬虫爬不进下一页了,怎么办
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 #-*- coding: UTF-8 -*- import scrapy from hoho.items import HohoItem import r ...
- 【用Java爬取网页图片——爬虫爬取数据】
用Java爬取网页图片--爬虫爬取数据 1.在创建项目中导入jsoup 2.创建一个保存下载图片的路径 3.使用URL读取网页路径,jsoup读取网页内容 4.利用属性标签获取图片连接块 5.因为该路 ...
- Python进阶之Scrapy-redis分布式爬虫抓取当当图书
Python进阶之Scrapy-redis分布式爬虫抓取当当图书 1. 准备工作 1.1 安装scrapy-redis 1.2 在windows安装redis程序 1.3 打开redis服务 2. 需 ...
- python怎么爬取知乎回答并制作词云_爬虫|爬取微博动态
爬取微博是爬虫新手入门项目,相对简单.但没想到还是遇到了些问题.. 0 踩点 老规矩第一步先踩点.某个用户的微博网址为:https://weibo.com/u/id,其中id是一长串数字,每个用户 ...
最新文章
- 问题二:相关性怎么引入?
- python中keyboardinterrupt_如何防止代码块在Python中被KeyboardInterrupt中断?
- php 获取时间段 今天昨天本周上周本月上月本季度本年去年
- HTML-通知公告Tips
- JVM学习笔记(一)JDKJREJVM
- windows下的nc下载地址
- 数据中心存储改造方案
- 使用Java实现一元二次方程求根计算器
- python从键盘输入一个数、计算出大于n的最小素数_python 从键盘任意输入一个正整数n,并找出大于n的最小素数,这个程序怎么写...
- 用知识图谱解读抑郁症——树洞
- 人在当时处境中,像旋涡中的一片落叶,身不由己
- 四叠半神话大系(bfs序+st+在线倍增+二分)(北理16校赛)
- Codeforces 332B Maximum Absurdity(DP+前缀和处理)
- 查询tian01\tian02\tian03总和
- 计算机考研英语复试自我介绍范文,2017考研英语复试自我介绍6篇
- charles+drony+android监听websocket
- 小程序毕设作品之微信美食菜谱小程序毕业设计成品(4)开题报告
- 北邮王啸:挖掘图神经网络中的「万物真理」 | 青源专栏
- C++编程 expected constructor, destructor, or type conversion before '(' token
- MYSQL比较两个数据库中表和字段的差异