V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  yeyu1989  ›  全部回复第 10 页 / 共 11 页
回复总数  204
1 ... 2  3  4  5  6  7  8  9  10  11  
2017-11-22 09:53:16 +08:00
回复了 yeyu1989 创建的主题 Python 帮分析爬取一个网页信息 cn.investing.com
@ospider @qwjhb @Marsss
非常感谢各位大神,终于可以了。
不过还有个小问题,就是 post 参数里的 pn:1,貌似只能得到第一页的 50 条记录,我试了一下好像只能一页一页的获取,要获取 70 多次。

这种有什么简便的办法吗?
2017-11-21 17:20:45 +08:00
回复了 yeyu1989 创建的主题 Python 帮分析爬取一个网页信息 cn.investing.com
@qwjhb
header={
'Accept':'application/json, text/javascript, */*; q=0.01',
'Accept-Encoding':'gzip, deflate, br',
'Accept-Language':'zh-CN,zh;q=0.9',
'Connection':'keep-alive',
'Content-Length':'909',
'Content-Type':'application/x-www-form-urlencoded',
'Host':'cn.investing.com',
'Origin':'https://cn.investing.com',
'Referer':'https://cn.investing.com/stock-screener/?sp=country::37|sector::a|industry::a|equityType::a|exchange::a%3Ceq_market_cap;1',
'User-Agent':'Opera/8.0 (Macintosh; PPC Mac OS X; U; en)',
'X-Requested-With':'XMLHttpRequest'
}
data={
'country[]':'37',
'sector':'2,11,7,10,1,4,9,5,8,3,6,12',
'industry':'63,85,82,21,10,86,7,78,36,25,4,28,67,5,71,27,61,90,23,68,34,89,43,50,81,41,56,59,69,9,83,29,52,100,58,95,102,94,60,53,38,87,31,6,16,48,55,74,66,35,65,40,99,42,92,98,39,70,32,45,77,20,54,33,24,72,51,30,64,2,96,8,14,22,26,80,15,37,93,13,46,1,79,44,75,91,49,62,88,12,47,84,57,76,17,97,18,19,3,11,101,73',
'equityType':'ORD,DRC,Preferred,Unit,ClosedEnd,REIT,ELKS,OpenEnd,Right,ParticipationShare,CapitalSecurity,PerpetualCapitalSecurity,GuaranteeCertificate,IGC,Warrant,SeniorNote,Debenture,ETF,ADR,ETC,ETN',
'exchange[]':'54',
'exchange[]':'103',
'pn':'1',
'order[col]':'eq_market_cap',
'order[dir]':'d'
}
session = requests.Session()
s = session.post('https://cn.investing.com/stock-screener/Service/SearchStocks',params=data,headers=header)
html = etree.HTML(s.text)

我理解应该是这么写的?但还是得不到想要的结果...
2017-11-21 10:04:02 +08:00
回复了 yeyu1989 创建的主题 Python 帮分析爬取一个网页信息 cn.investing.com
@qwjhb
我现在都是照猫画虎,还没有系统学习过。想着边用边学来着
2017-11-21 09:55:47 +08:00
回复了 yeyu1989 创建的主题 Python 帮分析爬取一个网页信息 cn.investing.com
@qwjhb
data={'sp':'country::37|sector::a|industry::a|equityType::a<eq_market_cap;1'}
header=func.randHeader()
s = requests.post('https://cn.investing.com/stock-screener/Service/SearchStocks',params=data,headers=header)
我这么写的,有什么问题吗?还是没有数据...
2017-11-21 08:45:30 +08:00
回复了 yeyu1989 创建的主题 Python 帮分析爬取一个网页信息 cn.investing.com
@qwjhb 恕我刚入门,没有看懂关键点在哪儿。。下一步应该做什么?
2017-11-21 08:17:52 +08:00
回复了 yeyu1989 创建的主题 Python 帮分析爬取一个网页信息 cn.investing.com
@ospider 渲染页面是指啥?
2017-09-20 14:15:34 +08:00
回复了 Sherlockhlt 创建的主题 Python 在python中如何删除文件的某一行?
这么多年过去了,这个问题有没有好的解决办法了呢
2017-08-23 12:35:42 +08:00
回复了 yeyu1989 创建的主题 Python Python 安装 scipy 报错
谢谢各位啊
已安装 anaconda
1 ... 2  3  4  5  6  7  8  9  10  11  
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2112 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 18ms · UTC 14:43 · PVG 22:43 · LAX 07:43 · JFK 10:43
Developed with CodeLauncher
♥ Do have faith in what you're doing.