我正在尝试将数据从https://www67.myfantasyleague.com/2019/export?TYPE=liveScoring&L=64741&APIKEY=&W=1&DETAILS=1
导入Google表格进行解析。特别是我想返回每个特许经营ID,以及哪些球员是子代孩子。
我尝试了Google工作表中的两个公式,但无法弄清楚为什么我没有得到任何结果。没有错误,只是一个空白单元格。
=IMPORTXML("https://www67.myfantasyleague.com/2019/export?TYPE=liveScoring&L=64741&APIKEY=&W=1&DETAILS=1&JSON=0","/"
=IMPORTXML("https://www67.myfantasyleague.com/2019/export?TYPE=liveScoring&L=64741&APIKEY=&W=1&DETAILS=1","//franchise[@id='0006']//players")
我在这里做错了什么?如果使用IMPORTDATA可以得到结果,但是我需要XML提供的结构来正确进行查询。非常感谢您的帮助!
这里是XML的代码段,我希望每个专营权ID下都有所有玩家ID(玩家ID可以在多个专营权ID下,仅供参考)
<liveScoring week="1">
<matchup>
<franchise id="0006" score="109.52" gameSecondsRemaining="0" playersYetToPlay="0" playersCurrentlyPlaying="0" isHome="0">
<players>
<player id="7393" score="25.30" gameSecondsRemaining="0" status="starter" updatedStats=""/>
<player id="14056" score="21.62" gameSecondsRemaining="0" status="starter" updatedStats=""/>
<player id="11672" score="0.00" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="11644" score="14.56" gameSecondsRemaining="0" status="starter" updatedStats=""/>
<player id="12634" score="7.50" gameSecondsRemaining="0" status="starter" updatedStats=""/>
<player id="11671" score="4.80" gameSecondsRemaining="0" status="starter" updatedStats=""/>
<player id="10261" score="0.00" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="9662" score="16.38" gameSecondsRemaining="0" status="starter" updatedStats=""/>
<player id="13722" score="14.40" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="13590" score="9.40" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="13633" score="10.40" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="9988" score="0.00" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="13678" score="0.00" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
</players>
</franchise>
<franchise id="0005" score="163.78" gameSecondsRemaining="0" playersYetToPlay="0" playersCurrentlyPlaying="0" isHome="1">
<players>
<player id="12184" score="24.30" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="11644" score="14.56" gameSecondsRemaining="0" status="starter" updatedStats=""/>
<player id="11227" score="12.70" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="10261" score="0.00" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="13636" score="5.50" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="9427" score="0.00" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="12154" score="0.00" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="10273" score="5.36" gameSecondsRemaining="0" status="starter" updatedStats=""/>
<player id="13606" score="10.30" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="13138" score="0.00" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="13968" score="0.00" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="9431" score="27.60" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="12197" score="3.00" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="12157" score="13.00" gameSecondsRemaining="0" status="starter" updatedStats=""/>
<player id="13130" score="42.90" gameSecondsRemaining="0" status="starter" updatedStats=""/>
<player id="12263" score="17.50" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="11192" score="23.20" gameSecondsRemaining="0" status="starter" updatedStats=""/>
<player id="11660" score="4.10" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="11677" score="3.70" gameSecondsRemaining="0" status="nonstarter" updatedStats=""/>
<player id="11257" score="7.00" gameSecondsRemaining="0" status="starter" updatedStats=""/>
</players>
</franchise>
</matchup>
"/"
和"//franchise[@id='0006']//players"
中的值为空。如果我的理解正确,那么这个答案如何?请认为这只是几个可能的答案之一。
"/"
和"//franchise[@id='0006']//players"
的xpath返回空值。对于以下公式,https://www67.myfantasyleague.com/2019/export?TYPE=liveScoring&L=64741&APIKEY=&W=1&DETAILS=1
的URL放在单元格A1
中。
当您要检索所有ID时,以下公式如何?
=IMPORTXML(A1,"//@id")
[当您想检索特许经营ID为“ 0006”的玩家ID时,遵循以下公式怎么样?
=IMPORTXML(A1,"//franchise[@id='0006']//player/@id")
结果:如果我误解了您的问题,但这不是您想要的结果,我深表歉意。