Python3爬虫--页面数据寻找及解析

目录

一、需求说明

二、页面数据源在内嵌Iframe

三、页面数据源为json

四、页面数据源为js

五、页面数据源为xml

六、代码解析



一、需求说明

近期有一个项目是爬取多家银行汇率,我提取了几个相似的案例,本文主要讲解页面数据获取方法。

二、页面数据源在内嵌Iframe

中银香港URL为: https://www.bochk.com/tc/investment/rates/deposit.html
实际数据URL为: https://www.bochk.com/whk/rates/depositRates/depositRates-input.action?lang=hk
需要爬取的数据如下图:
在这里插入图片描述页面数据寻找
在这里插入图片描述

三、页面数据源为json

汇丰银行URL为: https://www.personal.hsbc.com.hk/1/2/chinese/hk/investments/mkt-info/deposit-rates/interest-rates
实际数据URL为: https://rbwm-api.hsbc.com.hk/digital-pws-tools-investments-eapi-prod-proxy/v1/investments/interest-rate?ccyCode=HKD
需要爬取的数据如下图:
在这里插入图片描述页面数据如下
在这里插入图片描述

四、页面数据源为js

建银亚洲URL为: http://www.asia.ccb.com/hongkong_sc/personal/accounts/dep_rates.html
建银亚洲URL为: http://www.ccb.com/cn/home/news/HongKong/hkhqll01.js
需要爬取的数据如下图:
在这里插入图片描述页面数据如下
在这里插入图片描述

五、页面数据源为xml

汇丰银行URL为: https://www.dahsing.com/tc/html/program/hong_kong_dollar_deposit_rate.html
汇丰银行URL为: https://www.dahsing.com/tc/html/program/HKRateOutput_chi.xml
需要爬取的数据如下图:
在这里插入图片描述页面数据如下
在这里插入图片描述

六、代码解析

代码下载路径如下:
https://download.csdn.net/download/silentwolfyh/11296203

猜你喜欢

转载自blog.csdn.net/silentwolfyh/article/details/93062199
今日推荐