Hello guys, I hope there are people that are smart enough to help me solve my problem...
I have a list of links.
Each of the links have a website with an embedded video.
I would like macros to go to each link and extract the embedded video code from the page's source code and paste it to the cell on the right.
I wrote a script, which searches for a line that has "/embed/" and then extracts the whole line, which is what I need.
However, I don't know how to use the script without entering the link to the script manually each time and make the output result to the right of the link.
Picture:
Question.PNG
Excel file:question1.xlsx
Sub test()
Worksheets("sheet1").Select
Range(Cells(1, 1), Cells(12000, 1)) = ""
meta = "meta itemprop"
Result = "/embed/"
Dim str As String
indi = 2
Dim inarr As Variant
Dim outarr As Variant
Set FinHTTP = CreateObject("Microsoft.xmlHTTP")
Dim FinRows, FinCols
urlstring = "http://www.in.com/videos/watchvideo-raabta-title-song-100697232.html#block1"
FinHTTP.Open "GET", urlstring, False
FinHTTP.send
textmess = FinHTTP.responseText
'MsgBox textmess
FinRows = Split(FinHTTP.responseText, Chr(10))
For j = 0 To UBound(FinRows) - 1
' Cells(j + 1, 1) = FinRows(j)
str = FinRows(j)
If InStr(str, meta) > 0 Or InStr(str, Result) > 0 Then
Cells(indi, 1) = FinRows(j)
indi = indi + 1
End If
Next j
End Sub
Bookmarks