1.打开网站http://top.baidu.com/buzz?b=1&fr=topindex 2.右键找到源代码 3.用工具爬取数据 import requestsfrom bs4 import BeautifulSoupimport pandas as pdtitles=[]hots=[]url ...
分类:
其他好文 时间:
2020-03-22 01:25:54
阅读次数:
70
第五周 所花时间 15h左右 代码量 1000行左右 博客量 4篇 学到的知识点 python基础的一些知识 摘要:通过学习,对python中的BeautifulSoup有了一定的了解,通过和之前学过的requests库结合,爬取了2019年中国大学的排名。(数据均来自HTML页面) 一、中国大学排 ...
分类:
编程语言 时间:
2020-03-21 21:12:11
阅读次数:
88
import requestsimport bs4 url = "https://search.bilibili.com/all?keyword=%E7%BA%AA%E5%BD%95%E7%89%87"header={'User-Agent':""}de = requests.get(url)de. ...
分类:
其他好文 时间:
2020-03-21 21:04:39
阅读次数:
95
import requests from bs4 import BeautifulSoup as bs res = requests.get('http://politics.people.com.cn/GB/1024/index.html') content = res.content.decod ...
分类:
编程语言 时间:
2020-03-21 18:29:37
阅读次数:
75
1.导入相应库 2.打开网页,用F12查找网页代码调试程序 3.找到我们要爬取的代码 4.编写代码,爬取要的数据 5最后将数据可视化 ...
分类:
其他好文 时间:
2020-03-21 17:56:58
阅读次数:
125
以上为页面结构 import pandas as pd import requests as rq from bs4 import BeautifulSoup url="http://tieba.baidu.com/hottopic/browse/topicList?res_type=1" def ...
分类:
编程语言 时间:
2020-03-21 17:56:21
阅读次数:
126
教程来自: "【Python网络爬虫与信息提取】.MOOC. 北京理工大学" 目标:爬取 "最好大学网前50名大学" 代码如下: 教程里用的代码里没有最后两行,在pycharm里出不来结果,加上以后显示正常。需要注意 `f`后面有空格,下划线也是连着的两条。 输出结果为: ...
分类:
编程语言 时间:
2020-03-21 17:50:48
阅读次数:
87
import requestsfrom bs4 import BeautifulSoupurl = 'https://s.weibo.com/top/summary?cate=realtimehot'headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6 ...
分类:
其他好文 时间:
2020-03-21 16:34:43
阅读次数:
142
四周爬虫课第二周的练习,爬取赶集网二手物品下所有物品的信息。大致思路:1、爬取频道页url;2、爬取商品详情页url,写入mongodb,url_list表;3、从url_list表读取url,爬取商品信息,写入mongodb,p_info表分成3个py文件:1、channel_url.py,获取频 ...
分类:
其他好文 时间:
2020-03-21 16:15:30
阅读次数:
85