Hi there. My code is running and generating the necessary timestamps to viewership data from a YouTube link, however I can't seem to get the viewership to copy and print. Any help to extract this information from the YouTube code would be much appreciated.
Thanks
Here is a link as an example: [TABLE="width: 324"]
<tbody>[TR]
[TD="class: xl64, width: 324"]https://www.youtube.com/watch?v=xXh1QLK6f5s[/TD]
[/TR]
</tbody>[/TABLE]
Thanks
Here is a link as an example: [TABLE="width: 324"]
<tbody>[TR]
[TD="class: xl64, width: 324"]https://www.youtube.com/watch?v=xXh1QLK6f5s[/TD]
[/TR]
</tbody>[/TABLE]
Code:
Sub Collectest()
Application.Wait (Sheet1.Range("f2").Value)
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = False
.navigate Range("b4").Value
Do
DoEvents
Loop Until ie.readystate = READYSTATE_COMPLETE
Dim Doc As HTMLDocument
Set Doc = ie.Document
While ie.readystate <> 4
Wend
On Error Resume Next
Application.Wait (Now + TimeValue("00:00:05"))
Dim s As Integer
Dim i As Integer
s = Sheet1.Range("i3").Value
For i = 0 To s
Range("b7").Offset(i, (i2 * 2)).Value = Doc.getElementsByClassName("view-count style-scope yt-view-count-renderer")
Range("b7").Offset(i, (i2 * 2) - 1).Value = Now()
Range("b7").Offset(i, (i2 * 2) - 1).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveSheet.Paste
Application.CutCopyMode = False
Application.Wait (Now + TimeValue("00:00:01"))
Next i
Application.EnableEvents = True
End With