首页 > 解决方案 > Google Sheets ImportXML 的 XPath 查询以获取 YouTube 视频 URL 并从页面订阅计数

问题描述

我正在尝试导入 YouTube 订阅计数和频道 URL,但它不起作用。

我可以通过这个 https://prnt.sc/rjcw27导入视频视图//*[contains (@class, 'view-count')]

但是,当尝试从 YT 视频中获取频道 URL 时,它不起作用。https://prnt.sc/rjcvbm =+importxml(" https://www.youtube.com/watch?v=sLuR-4YxEns ","//*[包含 (@class, 'yt-simple-endpoint 样式-scope yt-formatted-string')]")

这也是我尝试过的:

=//yt-formatted-string[@id='text']/a/@href
="//*[contains (@class, 'style-scope ytd-c4-tabbed-header-renderer')]"
=//*[contains (@class, 'yt-simple-endpoint style-scope yt-formatted-string')]"
=//*[@id="subscriber-count"]

有人可以帮忙吗?

标签: xmlxpathgoogle-sheetsyoutube

解决方案


推荐阅读