Looping through youtube videos collecting the videos' URLs

Information related to the use of iMacros for Web Scraping, Data Mining and creating Mashups.

Moderator: iMacros Moderators

Looping through youtube videos collecting the videos' URLs

by Hannes, Tech Support on Wed Aug 13, 2008 12: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)

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

'close iMacros instance
iret = iim1.iimExit()

' exit script

As you see, the URLs are displayed by PROMPT. For saving them, you could use
Code: Select all
Hannes, iOpus Support
Hannes, Tech Support
Posts: 2120
Joined: Thu Sep 21, 2006 6:27 am

Return to How-To's and Examples for Web Scraping

Who is online

Users browsing this forum: No registered users and 1 guest

Website Monitoring