05-16-2023, 05:14 AM
Hi Dear Gintaras,
Could you please have a look at this code I wrote. It should be much faster if I use the clipboard.text method. But I got failed after spending hours. Could you please check it and point some problem and also give advices? So appreciate your help.
I write this code to scrape the youtube video information. I couldn't extract all the information once since youtube don't allow to show the upload time information. So I got this done with the help of another website. They all marked in the list.
Could you please have a look at this code I wrote. It should be much faster if I use the clipboard.text method. But I got failed after spending hours. Could you please check it and point some problem and also give advices? So appreciate your help.
I write this code to scrape the youtube video information. I couldn't extract all the information once since youtube don't allow to show the upload time information. So I got this done with the help of another website. They all marked in the list.
//https://intelx.io/tools?tab=youtube This site helps to get the upload and other information
//https://www.youtube.com/@laofangDDD/videos This is the site I will use to extract video information
// This code should work but a little bit slow
print.clear();
keys.send("Ctrl+Home");
var csv = new csvTable { ColumnCount = 4 };
var w = wnd.find(1, "老房叨叨叨 - YouTube - Google Chrome", "Chrome_WidgetWin_1");
w.Activate();
var x = wnd.find(1, "Tools - Intelligence X - Google Chrome", "Chrome_WidgetWin_1");
var z = x.Elm["web:GROUPING", prop: "@id=ytshortOutput"].Find(1);
opt.key.KeySpeed = 1;
foreach (var e in w.Elm["web:LINK", "* by 老房叨叨叨 *"].FindAll()){
var cells = new string[csv.ColumnCount];
e.Focus();
x.Activate();
var e2 = x.Elm["web:TEXT", "Enter YouTube Video URL"].Find(1);
e2.SendKeys("Ctrl+A", $"!{e.Value}"); keys.send("Enter");.2.s();
var title = z.Navigate("fi2").Name;
var data = z.Navigate("ch6 fi").Name.Split("\n")[1].Split(":")[1].TrimStart();
var view = z.Navigate("ch6 fi").Name.Split("\n")[10].Split(":")[1].TrimStart();
cells[0] = e.Value;cells[1] = title;cells[2] = data;cells[3] = view;
csv.AddRow(cells);
print.it(cells);
w.Activate();
}
print.it(csv);
csv.Save(folders.Desktop+"老房叨叨叨.csv");