该脚本旨在循环播放收集其 URL 的 Youtube 视频。
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=7601105 " + 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(
由于某种原因,它似乎不起作用。它返回: SyntaxError: unknown command: OPTION, line: 1 (Error code: -910) 请帮帮我。谢谢。
编辑:看起来我发现这个脚本必须作为 VBS 脚本(例如 File.vbs)运行,而不是直接在 Imacros 浏览器中运行。
但我仍然有一个问题。此脚本旨在保存在上述脚本中提取的 URL:
SET !EXTRACT {{!URLCURRENT}}
SAVEAS TYPE=EXTRACT FOLDER=myFolder FILE=myFile.csv
我应该在哪里准确插入这个?