ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 1039|回复: 9

[求助] 求助!为什么从网页获取数据总是重复抓取第一页

[复制链接]

TA的精华主题

TA的得分主题

发表于 2019-12-13 09:22 | 显示全部楼层 |阅读模式
本帖最后由 joeeeeee 于 2019-12-13 12:42 编辑

目标网址:https://info.sporttery.cn/football/match_result.php?page=1&search_league=25&start_date=2009-04-28&end_date=2019-12-13&dan=0


我按照这个教程:https://www.jianshu.com/p/03e8879ec9b8一步一步做但是结果总是重复抓取第一页数据。。




高级编辑器里的代码:
(p as number) as table =>
let
    源 = Web.Page(Web.Contents("https://info.sporttery.cn/football/match_result.php?page=" & "(Number.ToText(p))" & "&search_league=25&start_date=2009-04-28&end_date=2019-12-13&dan=0")),
    Data1 = 源{1}[Data],
    更改的类型 = Table.TransformColumnTypes(Data1,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}, {"Column7", type text}, {"Column8", type text}, {"Column9", type text}, {"Column10", type text}, {"Column11", type text}, {"Column12", type text}})
in
    更改的类型


恳求各位大神高手解答一下🐮🐮🐮

批注 2019-12-13 123220.jpg
批注 2019-12-13 123319.jpg
22.jpg

TA的精华主题

TA的得分主题

发表于 2019-12-13 11:55 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
page=1  这个值你固定了?

TA的精华主题

TA的得分主题

发表于 2019-12-13 12:04 | 显示全部楼层
先學習學習, 這種?後的 uri 是以get型式取的, 參數是?後再以&結合
https://info.sporttery.cn/football/match_result.php?
page=1
&search_league=25
&start_date=2009-04-28
&end_date=2019-12-13
&dan=0

看成這樣
你可以試調弄
page是頁面,只要把它循環就可以得出其他頁面
但有可能只需把&search_league=25  <<這個調大就可以拿取很多數據
試著辦

TA的精华主题

TA的得分主题

 楼主| 发表于 2019-12-13 12:25 | 显示全部楼层
lovemh1987 发表于 2019-12-13 11:55
page=1  这个值你固定了?

没有,我是按照那教程方法,先创建了一个查询然后把page那改为页码
就像这样
Web.Page(Web.Contents("https://info.sporttery.cn/football/match_result.php?page="&"[页码]"&"&search_league=25&start_date=2009-01-01&end_date=2019-12-12&dan=0"))

TA的精华主题

TA的得分主题

 楼主| 发表于 2019-12-13 12:34 | 显示全部楼层

TA的精华主题

TA的得分主题

 楼主| 发表于 2019-12-13 12:39 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
lovemh1987 发表于 2019-12-13 11:55
page=1  这个值你固定了?

没有固定吧,,高级编辑器里是这样的:
(p as number) as table =>
let
    源 = Web.Page(Web.Contents("https://info.sporttery.cn/football/match_result.php?page=" & "(Number.ToText(p))" & "&search_league=25&start_date=2009-04-28&end_date=2019-12-13&dan=0")),
    Data1 = 源{1}[Data],
    更改的类型 = Table.TransformColumnTypes(Data1,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}, {"Column7", type text}, {"Column8", type text}, {"Column9", type text}, {"Column10", type text}, {"Column11", type text}, {"Column12", type text}})
in
    更改的类型

TA的精华主题

TA的得分主题

 楼主| 发表于 2019-12-13 20:15 | 显示全部楼层
chis3 发表于 2019-12-13 12:04
先學習學習, 這種?後的 uri 是以get型式取的, 參數是?後再以&結合
https://info.sporttery.cn/football/ma ...

大佬大佬!!!OK了,真的不学习很恐怖
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

关闭

最新热点上一条 /1 下一条

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-4-23 17:42 , Processed in 0.042276 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表