- Autocommit - 2022/09/22 08:48:33
This commit is contained in:
1 parent
43186b9875
commit
fdc20dc0bc
2 files changed
+112
-2
No files matched your search
@@ -6,6 +6,8 @@ using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Security.Policy;
|
||||
using System.Net;
|
||||
using static System.Windows.Forms.LinkLabel;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace A69WD {
|
||||
|
||||
@@ -93,7 +95,10 @@ namespace A69WD {
|
||||
client.Headers.Add("Cookie", "euconsent-v2=CPG74goPG74goAKAeAENBcCsAP_AAH_AAAwIH3tf_X__bX9j-_59__t0eY1f9_7_v-wzjhfdt-8N2P_X_L0X42E7PF36pq4KuR4Eu3LBIQNlHOHUTUmw6okVrTPsak2Mr7NKJ7LEmnMZe2dYGHtfn91TuZKY7_78_9fz3_-v_v___9f3r-3_3__59X---_e_V399zLv9__3__9gfiASYal8AF2JY4Mk0aVQogQhWEh0AoAKKAYWiawgYXBTsrAI9QQMAEJqAjAiBBiCjFgEAAgEASERASAHggEQBEAgABACpAQgAImAQWAFgYBAAKAaFiBFAEIEhBkcFRymBARItFBPZWAJRd7GmEIZRYAUCj-iowEShBAsDISFg5gAA.YAAAAAAAAAAA");
|
||||
client.Headers.Add("DNT", "1");
|
||||
client.Headers.Add("TE", "Trailers");
|
||||
client.DownloadFile(new Uri(lk), fileName);
|
||||
client.DownloadProgressChanged += Client_DownloadProgressChanged;
|
||||
client.DownloadFileCompleted += Client_DownloadFileCompleted;
|
||||
string fn = Path.Combine(Cfg.Settings.PathAnalizadedRaccFile, GetFileName(lk));
|
||||
client.DownloadFile(new Uri(lk), fn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,6 +338,108 @@ namespace A69WD {
|
||||
return "Unk";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) {
|
||||
MessageBox.Show("Download complete !", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
return;
|
||||
object obj = new Object();
|
||||
lock (obj) {
|
||||
|
||||
conteggioEvt++;
|
||||
|
||||
StringBuilder sb;
|
||||
if (state == EngineStatusEnum.Starting) state = EngineStatusEnum.Started;
|
||||
|
||||
WebBrowser wb = sender as WebBrowser;
|
||||
string link = wb.Url.ToString();
|
||||
|
||||
// Se link di logon, devo terminare i download
|
||||
if (link == "https://www.annunci69.it/accedi.php?nop") {
|
||||
// Finito download:
|
||||
state = EngineStatusEnum.Stopping;
|
||||
// salvo gli archivi:
|
||||
SaveState();
|
||||
return;
|
||||
}
|
||||
|
||||
// Elimino ulteriori ripetizioni dell'evento:
|
||||
if (downloaded.Contains(link)) return;
|
||||
|
||||
// aggiorno UI
|
||||
RaiseEvent_Updating(wb.Name + " - (Evt" + conteggioEvt.ToString("0000") + ") Donwloaded: " + link.Replace("https://www.annunci69.it/racconti-erotici/", "./"));
|
||||
|
||||
// Se pagina è un racconto, lo salvo
|
||||
if (IsRacLink(link)) {
|
||||
sb = new StringBuilder();
|
||||
sb.Append(wb.Document.Body.InnerHtml);
|
||||
string fn = Path.Combine(Cfg.Settings.PathAnalizadedRaccFile, GetFileName(link));
|
||||
//cTools.WriteTextFile(fn, sb, Encoding.GetEncoding(wb.Document.Encoding));
|
||||
cTools.WriteTextFile(fn, sb);
|
||||
}
|
||||
|
||||
// Registro che ho eseguito il download del link
|
||||
downloaded.Add(link);
|
||||
|
||||
// Ciclo su tutti i link estratti dalla pagina:
|
||||
foreach (HtmlElement item in wb.Document.Links) {
|
||||
link = item.GetAttribute("href");
|
||||
// Se link nuovo:
|
||||
if (!allLinks.Contains(link)) {
|
||||
// elimino il link di logon
|
||||
if (link == "https://www.annunci69.it/accedi.php?nop") break;
|
||||
// Link nuovo, mi comporto di conseguenza alla tipologia:
|
||||
if (IsRacLink(link)) {
|
||||
// Link ad un racconto
|
||||
allLinks.Add(link);
|
||||
if (downRac) { toDownload.Add(link); }
|
||||
racLinks.Add(link);
|
||||
} else {
|
||||
if (IsIdxLink(link)) {
|
||||
// Link ad un indice
|
||||
allLinks.Add(link);
|
||||
toDownload.Add(link);
|
||||
} else {
|
||||
// Link non riconosciuto, lo scarto
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // fine ciclo sui link estratti
|
||||
|
||||
// Se ho raggiunto il massimo numero di link, o non vi sono link da downloadare, mi fermo:
|
||||
if ((toDownload.Count > 0) && (state == EngineStatusEnum.Started)) {
|
||||
// proseguo con il download:
|
||||
string lk = toDownload.First();
|
||||
toDownload.Remove(lk);
|
||||
wb.Navigate(lk);
|
||||
} else {
|
||||
// Finito download:
|
||||
state = EngineStatusEnum.Stopping;
|
||||
// salvo gli archivi:
|
||||
SaveState();
|
||||
}
|
||||
|
||||
}//lock
|
||||
|
||||
}
|
||||
|
||||
private void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) {
|
||||
////Update progress bar & label
|
||||
//Invoke(new MethodInvoker(delegate () {
|
||||
// progressBar.Minimum = 0;
|
||||
// double receive = double.Parse(e.BytesReceived.ToString());
|
||||
// double total = double.Parse(e.TotalBytesToReceive.ToString());
|
||||
// double percentage = receive / total * 100;
|
||||
// lblStatus.Text = $"Downloaded {string.Format("{0:0.##}", percentage)}%";
|
||||
// progressBar.Value = int.Parse(Math.Truncate(percentage).ToString());
|
||||
//}));
|
||||
}
|
||||
}//class cA69Engine2
|
||||
|
||||
|
||||
|
||||
@@ -23,9 +23,12 @@ namespace A69WD {
|
||||
this.Text = String.Format("A69WD - Dowloader Testi Vrs {0}", cTools.AssemblyVersion);
|
||||
engine = new cA69Engine(this.wb1);
|
||||
engine.Updating += Engine_Updating;
|
||||
engine2 = new cA69Engine2();
|
||||
engine2.Updating += Engine_Updating;
|
||||
}
|
||||
|
||||
cA69Engine engine = null;
|
||||
cA69Engine2 engine2 = null;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -180,7 +183,7 @@ namespace A69WD {
|
||||
#region Test ENGINE2
|
||||
|
||||
private void button1_Click(object sender, EventArgs e) {
|
||||
|
||||
engine2.Start(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user