Looping through youtube videos collecting the videos' URLs

Information related to the use of iMacros for Web Scraping, Data Mining and creating Mashups.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team
Post Reply
Hannes, Tech Support

Looping through youtube videos collecting the videos' URLs

Post by Hannes, Tech Support » Wed Aug 13, 2008 7:55 am

Code: Select all

Option Explicit

'initiate iMacros instance 
Dim iim1, iret
set iim1 = CreateObject ("imacros")
iret = iim1.iimInit()

'navigate to youtube frontpage
Dim macro
macro = "CODE:"
macro = macro + "VERSION BUILD=6200707     " + vbNewLine
macro = macro + "TAB T=1     " + vbNewLine
macro = macro + "TAB CLOSEALLOTHERS     " + vbNewLine
macro = macro + "URL GOTO=http://www.youtube.com/     " + vbNewLine

iret = iim1.iimPlay(macro)

'loop through videos
Dim counter
counter = 0
do while not iret < 0
	counter = counter + 1
	macro = "CODE:"
	macro = macro + "TAG POS=R"+Cstr(counter)+" TYPE=IMG ATTR=CLASS:vimg120&&TITLE:*&&HREF:*&&NAME:*&&ALT:video&&SRC:*   " + vbNewLine
	macro = macro + "PROMPT Current<SP>URL:<SP>{{!URLCURRENT}}" + vbNewLine
	macro = macro + "BACK"
	iret = iim1.iimPlay(macro)
loop


'end
msgbox "End. We'll close the iMacros browser and exit the VBS script."

'close iMacros instance
iret = iim1.iimExit()

' exit script
Wscript.Quit()
As you see, the URLs are displayed by PROMPT. For saving them, you could use

Code: Select all

SET !EXTRACT {{!URLCURRENT}}
SAVEAS TYPE=EXTRACT FOLDER=myFolder FILE=myFile.csv
Post Reply