我可以使用此代码获取视频名称。但为了获取频道 ID,我将“title”更改为“channel_id”,但不起作用……我想获取频道 ID 而不是标题
MsgBox, % YouTubeTitle("https://www.youtube.com/watch?v=YzL0OBjnK8o")
return
YouTubeTitle(url) {
hObject := ComObjCreate("WinHttp.WinHttpRequest.5.1")
hObject.Open("GET", url)
hObject.Send()
RegExMatch(hObject.ResponseText, "(?<=title>).*?(?= - YouTube</title>)", title)
return title
}
答案1
这应该会给你频道 ID:
MsgBox, % YouTubeChannelId("https://www.youtube.com/watch?v=YzL0OBjnK8o")
return
YouTubeChannelId(url) {
hObject := ComObjCreate("WinHttp.WinHttpRequest.5.1")
hObject.Open("GET", url)
hObject.Send()
RegExMatch(hObject.ResponseText, "itemprop=""author"".+?channel\/([^""]+)", ChannelId)
return ChannelId1
}