Помогите разобраться, в чем ошибка!!! Я открываю InternetExplorer.Application и загружаю туда нужный документ, а потом прохожусь по нужным мне ссылкам и сохраняю нужную мне инфу в файл. Прога работает, но просле прохода энного кол-ва ссылок(причем каждый раз по-разному), возникает ошибка: HTTP 400 - ошибочный запрос | Код | //Array of link we need (whre title is str) function GetLinks(El,Str1,Str2) { var Ret=new Array(); var i=0,k=0; while (El[i]) { if (El[i].title==Str1 || El[i].title==Str2) { Ret[k]=El[i].href; k++; } i++ } return Ret; } //--------------------------------------------------------------------------------------------------------------------- var ie=WScript.CreateObject("InternetExplorer.Application"); var fso=WScript.CreateObject("Scripting.FileSystemObject");
var source="http://lekarstwo.ru/alfavit/"; ie.Navigate(source); while (ie.Busy) WScript.Sleep(10); var Doc=ie.Document; ie.Visible=true;
var dop=Doc.getElementsByTagName("A");//all title //search our A-Z var Alphavit = GetLinks(dop,"для просмотра нажмите на букву","Для просмотра нажмите на букву");
//Create text file with discription of sinonims var file=fso.OpenTextFile("Sinonims.txt",2);
//On each page var i=0,j=0,k; var text=""; var Sin,words=new Array(); while (Alphavit[i]) { ie.Navigate(Alphavit[i]); while (ie.Busy) WScript.Sleep(10); var Doc=ie.Document; //Each preparat dop=Doc.getElementsByTagName("A");//all title var allPreparats = GetLinks(dop,"Просмотреть информацию о препарате"); while (allPreparats[j]) { //load the page with info ie.Navigate(allPreparats[j]); while (ie.Busy) WScript.Sleep(10); var Doc=ie.Document; //Serch sinonims dop=Doc.getElementsByTagName("div");//all title if (dop[10]) { // !!!!!!!! Обработка текста про препарат !!!!!!!!!!! // Name of preparat - 10th div, first word words=dop[10].innerText.split(/\s\(/); text=words[0]; //Sinionims: for (k=11;k<16;k++) { words=dop[k].innerText.split(/\s/); if (words[0]=="Синонимы:" || words[0]=="Синоним:") { Sin=dop[k].innerText.split(/:\s/); Sin=Sin[1].split(/,\s/); k=0; while (Sin[k]) { text+=' | '+Sin[k]; k++; } break; } } file.WriteLine(text); } j++; } i++; }
file.Close(); Set ie = Nothing; WScript.Quit(0);
|
Помогите плыыыыыыыыз!!!!
|