0

I can get the video name using this code. But to get the channel id I change the "title" to "channel_id" but it doesn't work... I want to get channel id instead of title

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 Answer 1

2

This should give you the channel 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
}
1
  • Thanks this is great :)
    – emreya
    Commented Nov 8, 2021 at 22:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .