- Testata estrazione die link alle pagine di indice - Testata estrazione dei link ai racconti - iniziato ad inserire un service per la gestione parallela. ToDo: - Aggiungere gestione parallela - Aggiungere analisi di quanto downloadato per estrarre altri link e proseguire con lo skraping - Aumentare i log in modo da tenere traccia di quanto succede - Animare la UI in modo da far capire cosa succede
79 lines
3.1 KiB
C#
79 lines
3.1 KiB
C#
using System;
|
|
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Runtime.Remoting.Messaging;
|
|
using System.Security.Policy;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace A69WD.Net {
|
|
public class cLink_A69 : iLink {
|
|
public static string PageBase { get { return "https://www.annunci69.it"; } }
|
|
public static string LoginPageUrl { get { return "https://www.annunci69.it/accedi.php"; } }
|
|
public static string LoginPostUrl { get { return "https://www.annunci69.it/include/auth/index.php"; } }
|
|
public static string LinkIdxBase { get { return "https://www.annunci69.it/racconti-erotici/racconti_lista.php?genere={Categoria}&pagina={ID}"; } }
|
|
public string[] Categorie { get { return Categorie; } }
|
|
private static readonly string[] categorie = { "altro", "bdsm", "gay", "incesto", "lesbo", "orge", "prime", "scambio", "tradimenti", "trans", "trio" };
|
|
private readonly string filename;
|
|
private readonly string filepath;
|
|
private eLinkState status = eLinkState.ToConfirm;
|
|
private string fields;
|
|
|
|
public string ID => "A69";
|
|
|
|
public string URL { get; }
|
|
|
|
public string FileName => filename;
|
|
|
|
public string FilePath { get => filepath; }
|
|
|
|
public bool Validate => true;
|
|
|
|
public eLinkState Status { get => status; set { status = value; } }
|
|
|
|
public string Fields { get => fields; set => fields = value; }
|
|
|
|
public cLink_A69(string Url, string Filename, string fields = "none", string Filepath = "") {
|
|
this.URL = Url;
|
|
this.filename = Filename;
|
|
this.fields = fields;
|
|
this.filepath = string.IsNullOrEmpty(Filepath) ? Cfg.Settings.PathDownloadWorking : Filepath;
|
|
this.status = eLinkState.ToConfirm;
|
|
}
|
|
|
|
|
|
|
|
public static List<iLink> GetStartLink() {
|
|
List<iLink> links = new List<iLink>();
|
|
for (int i = 0; i < 10; i++) {
|
|
foreach (string cat in categorie) {
|
|
string url = LinkIdxBase.Replace("{Categoria}", cat).Replace("{ID}", i.ToString());
|
|
string name = string.Format("_A69_{0}_{1}.html", cat, i.ToString());
|
|
links.Add(new cLink_A69(url, name));
|
|
}
|
|
}
|
|
return links;
|
|
}
|
|
|
|
public static bool InsertStartLink(BlockingCollection<iLink> _urlQueue) {
|
|
int i = 1;
|
|
try {
|
|
foreach (string cat in categorie) {
|
|
string url = LinkIdxBase.Replace("{Categoria}", cat).Replace("{ID}", i.ToString());
|
|
string name = string.Format("_A69_{0}_{1}.html", cat, i.ToString("0000"));
|
|
_urlQueue.Add(new cLink_A69(url, name));
|
|
}
|
|
return true;
|
|
} catch (Exception ex) {
|
|
Logger.Error("Errore inserendo A69 Start Link - " + ex.Message);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
}//class cLink_A69
|
|
|
|
}//namespace A69WD.Net
|
|
|