提取 HTM 时,它不会将数据保存到文件
When extracting HTM its doesnt save data to file
我的代码有问题,它只从变量 id 中提取数据而没有提取标题。但是如果我删除了 id 的提取,标题正在保存,我想这可能是我提取 HTM 的问题。
有人可以解释我做错了什么吗?
var i = 1;
while(iimPlayCode('SET !TIMEOUT_STEP 1\nTAG POS='+i+' TYPE=A ATTR=CLASS:"pl-video-title-link*" CONTENT=EVENT:MOUSEOVER')>0) {
iimPlayCode('TAG POS='+i+' TYPE=A ATTR=CLASS:"pl-video-title-link*" EXTRACT=TXT\n')
var title = iimGetLastExtract();
var title = title.replace(/\s+/g, '');
iimSet('title',title);
iimPlayCode('TAG POS='+i+' TYPE=TR ATTR=data-video-id:"*" EXTRACT=HTM\n')
var id = iimGetLastExtract();
var id = id.match(/data-video-id="(.+?)"/)[1];
iimSet('id',id);
iimPlayCode('SET !EXTRACT {{title}}\nSET !EXTRACT {{id}}\nSAVEAS TYPE=EXTRACT FOLDER=* FILE=Output_for_Youtube_Playlist.csv\n');
i++;
}
好的,我弄明白了,我忘了在正则表达式的单引号之间加上 space 我认为这是问题所在,我重新制作了脚本结构
while(iimPlayCode('SET !TIMEOUT_STEP 1\nTAG POS='+i+' TYPE=A ATTR=CLASS:"pl-video-title-link*" CONTENT=EVENT:MOUSEOVER')>0) {
iimPlay('Code:'
+ 'TAG POS='+i+' TYPE=A ATTR=CLASS:"pl-video-title-link*" EXTRACT=TXT\n'
+ 'TAG POS='+i+' TYPE=TR ATTR=data-video-id:"*" EXTRACT=HTM\n'
)
var title = iimGetExtract(1);
title = title.replace(/\s+/g, ' ');
var id = iimGetExtract(2);
var id = id.match(/data-video-id="(.+?)"/)[1];
saveRes = 'CODE:';
saveRes += 'ADD !EXTRACT "'+title+'"' + '\n';
saveRes += 'ADD !EXTRACT "'+id+'"' + '\n';
saveRes += 'SAVEAS TYPE=EXTRACT FOLDER=* FILE=Output_for_Youtube_Playlist.csv\n';
iimPlay(saveRes);
i++;
}
我的代码有问题,它只从变量 id 中提取数据而没有提取标题。但是如果我删除了 id 的提取,标题正在保存,我想这可能是我提取 HTM 的问题。 有人可以解释我做错了什么吗?
var i = 1;
while(iimPlayCode('SET !TIMEOUT_STEP 1\nTAG POS='+i+' TYPE=A ATTR=CLASS:"pl-video-title-link*" CONTENT=EVENT:MOUSEOVER')>0) {
iimPlayCode('TAG POS='+i+' TYPE=A ATTR=CLASS:"pl-video-title-link*" EXTRACT=TXT\n')
var title = iimGetLastExtract();
var title = title.replace(/\s+/g, '');
iimSet('title',title);
iimPlayCode('TAG POS='+i+' TYPE=TR ATTR=data-video-id:"*" EXTRACT=HTM\n')
var id = iimGetLastExtract();
var id = id.match(/data-video-id="(.+?)"/)[1];
iimSet('id',id);
iimPlayCode('SET !EXTRACT {{title}}\nSET !EXTRACT {{id}}\nSAVEAS TYPE=EXTRACT FOLDER=* FILE=Output_for_Youtube_Playlist.csv\n');
i++;
}
好的,我弄明白了,我忘了在正则表达式的单引号之间加上 space 我认为这是问题所在,我重新制作了脚本结构
while(iimPlayCode('SET !TIMEOUT_STEP 1\nTAG POS='+i+' TYPE=A ATTR=CLASS:"pl-video-title-link*" CONTENT=EVENT:MOUSEOVER')>0) {
iimPlay('Code:'
+ 'TAG POS='+i+' TYPE=A ATTR=CLASS:"pl-video-title-link*" EXTRACT=TXT\n'
+ 'TAG POS='+i+' TYPE=TR ATTR=data-video-id:"*" EXTRACT=HTM\n'
)
var title = iimGetExtract(1);
title = title.replace(/\s+/g, ' ');
var id = iimGetExtract(2);
var id = id.match(/data-video-id="(.+?)"/)[1];
saveRes = 'CODE:';
saveRes += 'ADD !EXTRACT "'+title+'"' + '\n';
saveRes += 'ADD !EXTRACT "'+id+'"' + '\n';
saveRes += 'SAVEAS TYPE=EXTRACT FOLDER=* FILE=Output_for_Youtube_Playlist.csv\n';
iimPlay(saveRes);
i++;
}