我们来获取这里的title和url然后再获取这里面url的编辑作者

可以看到右边的几个就对应的左边不同的div

.m-p1-mb2-list.m-list-container ul li a
import requests
from bs4 import BeautifulSoup html = requests.get('https://finance.sina.com.cn/')
html.encoding='utf-8' soup = BeautifulSoup(html.text,'lxml')
zq = soup.select('.m-p1-mb2-list.m-list-container ul li a')
for z in zq:
print('title:',z.text)
print('url:',z['href'])
Innerhtml = requests.get(z['href'])
Innerhtml.encoding='utf-8'
soup2 = BeautifulSoup(Innerhtml.text,'lxml')
writers = soup2.select('.article-editor')
for w in writers:
print(w.text)
print('*'*50)

结果

G:\python3.8\python.exe "F:/python post/code/实战/新浪财经.py"
title: 创业板现场督导来了:有投行已接通知 监管带着问题来
url: https://finance.sina.com.cn/stock/zqgd/2020-09-14/doc-iivhuipp4150274.shtml
责任编辑:常福强
**************************************************
title: 2020金牌董秘评选开启 寻上市公司资本品牌最佳代言人
url: http://finance.sina.com.cn/zt_d/2020jinpaidongmi/
title: 直播|
url: http://finance.sina.com.cn/zt_d/jjzbj/
title: 陈果、华夏嘉实长盛长安富国大通等直播解盘
url: https://finance.sina.com.cn/money/fund/original/2020-09-12/doc-iivhvpwy6361399.shtml?cref=cj
责任编辑:常福强
**************************************************
title: 研报|
url: http://finance.sina.com.cn/stock/reportch/jinqilin.shtml
title: 内部经济复苏仍是主线 关注政府性投资需求带动
url: https://finance.sina.com.cn/stock/marketresearch/2020-09-13/doc-iivhvpwy6487946.shtml
责任编辑:陈志杰
**************************************************
title:
url: https://finance.sina.com.cn/stock/s/2019-07-09/doc-ihytcitm0843478.shtml
责任编辑:陈志杰
**************************************************
title: 公司
url: http://finance.sina.com.cn/roll/index.d.html?cid=56592&page=1
title: 业绩亏损套现不断 朗姿股份实控人的资产腾挪术
url: https://finance.sina.com.cn/roll/2020-09-14/doc-iivhuipp4201666.shtml
责任编辑:张熠
**************************************************
title: 老大哥燕京啤酒危险时刻:营收净利降 增长率十年新低
url: https://finance.sina.com.cn/stock/t/2020-09-14/doc-iivhuipp4175419.shtml
责任编辑:常福强
**************************************************
title:
url: https://finance.sina.com.cn/wm/2020-07-12/doc-iivhuipn2580833.shtml
责任编辑:逯文云
**************************************************
title: 违规代客炒股 万和、新时代、民生等多券商密集受罚
url: https://finance.sina.com.cn/stock/zqgd/2020-09-14/doc-iivhvpwy6527324.shtml
责任编辑:常福强
**************************************************
title: 超级打新周:19只新股 火箭、美妆、医美…全是热点
url: https://finance.sina.com.cn/stock/zqgd/2020-09-14/doc-iivhvpwy6557166.shtml Process finished with exit code -1

python爬取新浪财经的更多相关文章

  1. Python 爬取所有51VOA网站的Learn a words文本及mp3音频

    Python 爬取所有51VOA网站的Learn a words文本及mp3音频 #!/usr/bin/env python # -*- coding: utf-8 -*- #Python 爬取所有5 ...

  2. python爬取网站数据

    开学前接了一个任务,内容是从网上爬取特定属性的数据.正好之前学了python,练练手. 编码问题 因为涉及到中文,所以必然地涉及到了编码的问题,这一次借这个机会算是彻底搞清楚了. 问题要从文字的编码讲 ...

  3. python爬取某个网页的图片-如百度贴吧

    python爬取某个网页的图片-如百度贴吧 作者:vpoet mail:vpoet_sir@163.com 注:随意copy,不用告诉我 #coding:utf-8 import urllib imp ...

  4. Python:爬取乌云厂商列表,使用BeautifulSoup解析

    在SSS论坛看到有人写的Python爬取乌云厂商,想练一下手,就照着重新写了一遍 原帖:http://bbs.sssie.com/thread-965-1-1.html #coding:utf- im ...

  5. 使用python爬取MedSci上的期刊信息

    使用python爬取medsci上的期刊信息,通过设定条件,然后获取相应的期刊的的影响因子排名,期刊名称,英文全称和影响因子.主要过程如下: 首先,通过分析网站http://www.medsci.cn ...

  6. python爬取免费优质IP归属地查询接口

    python爬取免费优质IP归属地查询接口 具体不表,我今天要做的工作就是: 需要将数据库中大量ip查询出起归属地 刚开始感觉好简单啊,毕竟只需要从百度找个免费接口然后来个python脚本跑一晚上就o ...

  7. Python爬取豆瓣指定书籍的短评

    Python爬取豆瓣指定书籍的短评 #!/usr/bin/python # coding=utf-8 import re import sys import time import random im ...

  8. python爬取网页的通用代码框架

    python爬取网页的通用代码框架: def getHTMLText(url):#参数code缺省值为‘utf-8’(编码方式) try: r=requests.get(url,timeout=30) ...

  9. 没有内涵段子可以刷了,利用Python爬取段友之家贴吧图片和小视频(含源码)

    由于最新的视频整顿风波,内涵段子APP被迫关闭,广大段友无家可归,但是最近发现了一个"段友"的app,版本更新也挺快,正在号召广大段友回家,如下图,有兴趣的可以下载看看(ps:我不 ...

随机推荐

  1. Springboot + Rabbitmq + WebSocet + vue

    1.pom.xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId& ...

  2. 线程池之Executor框架

    线程池之Executor框架 Java的线程既是工作单元,也是执行机制.从JDK5开始,把工作机单元和执行机制分离开来.工作单元包括Runnable和Callable,而执行机制由Executor框架 ...

  3. CentOS7上lvm分区调整(resize2fs: Bad magic number in super-block while trying to open ...)

    问题描述:根目录空间占用率100% 首先用传统resize2fs方式调整分区: resize2fs -p /dev/mapper/centos-home 50Gresize2fs 1.42.9 (28 ...

  4. 点击按钮出现时间javascrip代码

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  5. xmind8 破解激活教程

    这里以windows为例来演示,其它操作系统需根据情况修改相应步骤. 一.下载安装包 首先去xmind国外官网下载对应操作系统的安装包,国内官网的那个是有残缺的,不支持破解. 官网下载链接 二.下载破 ...

  6. laravel在视图中使用类似于“__PUBLIC__”,“__UPLOADS__”的操作

    首先在config文件夹下建立static.php文件 然后在里面定义常量 例: <?php define('__PUBLIC__', '/'); define('__UPLOADS__', ' ...

  7. Mono嵌入C++

    http://docs.go-mono.com/index.aspx?link=xhtml%3Adeploy%2Fmono-api-embedding.html https://www.mono-pr ...

  8. Web测试和前端技术

    Html Form表单 用户需要输入内容的地方一般有一个表单元素 method:GET/POST action:要打开/提交的目文件 Table表格 检查表格数据和数据库的一致性 表格的布局检测:填满 ...

  9. Educational Codeforces Round 68 (Rated for Div. 2)-C-From S To T

    You are given three strings ss, tt and pp consisting of lowercase Latin letters. You may perform any ...

  10. SSM框架之mybatis极速入门!