- Autocommit - 2021/10/26 18:01:11

This commit is contained in:
CSiCoAlm committed 2021-10-26 18:01:11 +02:00
1 parent 41a277b313
commit 1738b75b2f
3 files changed
+19 -7

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
#+SETUPFILE: ~/.MyCfg/emacs/templates/org-html-themes/theme-readtheorg-local.setup
#+TITLE: Web Scraper per A69
#+DESCRIPTION: Diario di bordo dell'applicazione per ricavare i racconti dal sito A69
#+KEYWORDS: ATDB, ATWD
* TODO Inserire nello stato i conteggio dei link
* TODO Inserire il conto dei link anche sul nome del file o fare report
Inserire sul nome dei file, oltre alla data anche il numero di link che contengono, oppure fare un report che riassuma quanto fatto e che torna utile per confrontare due download diversi ecc...
+1 -1
View File
@@ -114,7 +114,7 @@
this.tbPath.Name = "tbPath";
this.tbPath.Size = new System.Drawing.Size(344, 20);
this.tbPath.TabIndex = 7;
this.tbPath.Text = "C:\\_Autodelete\\";
this.tbPath.Text = "C:\\Temporary\\A69WD\\Dst\\";
this.tbPath.TextChanged += new System.EventHandler(this.tbPath_TextChanged);
//
// btbPath
+9 -6
View File
@@ -51,7 +51,7 @@ namespace A69WD {
get {
if (string.IsNullOrEmpty(dstRac)) {
// creo path e verifico l'esistenza
dstRac = Path.Combine(System.IO.Path.Combine(tbPath.Text, DateTime.Now.ToString("yyyy-MM-dd")), "Indici");
dstRac = Path.Combine(System.IO.Path.Combine(tbPath.Text, DateTime.Now.ToString("yyyy-MM-dd")), "Testi");
if (!Directory.Exists(dstRac)) Directory.CreateDirectory(dstRac);
}
return dstRac;
@@ -92,7 +92,7 @@ namespace A69WD {
DownRac = false;
lblST.Text = "Inizio lo scrap dei link dei racconti";
UpdateST("Inizio lo scrap dei link dei racconti");
if ((toDownload.Count > 0) && (cnt < MAXLINK)) {
// proseguo con il download:
string lk = toDownload.First();
@@ -109,7 +109,7 @@ namespace A69WD {
DownRac = true;
lblST.Text = "Inizio lo scrap dei link dei racconti";
UpdateST("Inizio lo scrap dei link dei racconti");
if ((toDownload.Count > 0) && (cnt < MAXLINK)) {
// proseguo con il download:
string lk = toDownload.First();
@@ -149,13 +149,14 @@ namespace A69WD {
string link = wb.Url.ToString();
// aggiorno UI
lblST.Text = wb.Name + " - Donwloaded: " + link;
UpdateST(wb.Name + " - Donwloaded: " + link);
// Se pagina è un racconto, lo salvo
if (IsRacLink(link)) {
sb = new StringBuilder();
sb.Append(wb.DocumentText);
cTools.WriteTextFile(Path.Combine(dstRac, GetFileName(link)), sb);
string fn = Path.Combine(DstRac, GetFileName(link));
cTools.WriteTextFile(fn, sb);
}
// Registro che ho eseguito il download del link
@@ -237,7 +238,7 @@ namespace A69WD {
cTools.WriteTextFile(Path.Combine(DstIdx, string.Format("_A69_RacLinks_{0}.tes", dt)), sb);
// avviso utente:
lblST.Text = string.Format("Finito il download in {0}", DateTime.Now - dtStartTime);
UpdateST(string.Format("Finito il download in {0}", DateTime.Now - dtStartTime));
// Riattivo UI:
btnDownloadLink.Enabled = true;
@@ -249,6 +250,8 @@ namespace A69WD {
private void UpdateST(string Msg) { lblST.Text = string.Format("{0} - {1} - {2}", DateTime.Now.ToString("HH:mm:ss"), cnt.ToString("0000"), Msg); }
private string GetFileName(string url) { return url.Replace("https://www.annunci69.it/racconti-erotici/", "A69_").Replace("/", "_").Replace(":", "_").Replace(@"\", "_"); }
private bool IsIdxLink(string link) { return link.StartsWith(BASE_LINK_IDX); }
private bool IsRacLink(string link) { foreach (string tip in Tipologie) { if (link.StartsWith(BASE_LINK_RAC + tip + "/")) return true; } return false; }