In the following working code, I am trying to navigate to specific youtube channel To get the videos names into excel .. It is working but partially as the code just lists about 30 videos only
Dim x, html As Object, ele As Object, sKeyWords As String, i As Long
With CreateObject("MSXML2.ServerXMLHTTP")
.Open "GET", "youtube channel url videos", False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.send
If .Status <> 200 Then MsgBox "Problem" & vbNewLine & .Status & " - " & .statusText: Exit Sub
Set html = CreateObject("htmlfile")
html.body.innerHTML = .responseText
How can I maje the code load all the content of the page ..? so as to get all the videos that are listed there.
I have found a site that lists all the videos in one table but as for the part of scraping the table, I failed to extract the video name or even dealing with the table Here's my try
Sub Post_Method()
Dim http As New XMLHTTP60
Dim html As New HTMLDocument
Dim htmla As Object
Dim trow As Object
Dim tcel As Object
Dim strArg As String
Dim c As Long
Dim x As Long
strArg = "inputType=1&stringInput=https%3A%2F%2Fwww.youtube.com%2Fchannel%2FUC43lrLHl4EhxaKQn2HrcJPQ&limit=100&keyType=default&customKey="
With http
.Open "POST", "https://youtube-playlist-analyzer.appspot.com/submit", False
.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
.send strArg
html.body.innerHTML = .responseText
' WriteTxtFile html.body.innerHTML
End With
Dim posts As Object, elem As Object, r As Long
'This part I can't adjust
'------------------------
Set posts = html.getElementById("container").getElementById("tableContainer").getElementById("tableData")
For Each elem In posts.Children
For Each trow In elem.Cells
c = c + 1: Cells(r + 1, c) = trow.innerText
Next trow
c = 0: r = r + 1
Next elem
'----------------------------------
Stop
End Sub