From d104fbf1c702b2ae42bbd767b0735b63d0854ae3 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sun, 1 Apr 2018 20:04:28 +0200 Subject: [PATCH] Do not delete entries with only attachments Add curl time limit: 10s max --- Program.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Program.cs b/Program.cs index 2cc8f15..152d5c1 100644 --- a/Program.cs +++ b/Program.cs @@ -339,20 +339,22 @@ namespace ModIndexer "//div[@class='content']" ); - if (bodyNode == null) + if (bodyNode == null) { + // Topic is dead. Remove mod. + info.type = (int)Misc.DATA_TYPE.INVALID; + Console.WriteLine("\tDead mod: " + mod_name); return; + } HtmlNodeCollection content = bodyNode[0].SelectNodes(".//a[@class='postlink']"); if (content == null) { Console.WriteLine("\tNo download links embedded."); - // Topic is dead. Remove mod. - info.type = (int)Misc.DATA_TYPE.INVALID; return; } string link = ""; - int uglyness = PRIORITY_WORST; + int uglyness = PRIORITY_WORST - 10; foreach (HtmlNode dtNode in content) { string url_raw = dtNode.GetAttributeValue("href", ""); @@ -425,7 +427,7 @@ namespace ModIndexer var proc_info = new System.Diagnostics.ProcessStartInfo(); proc_info.FileName = "curl"; - proc_info.Arguments = "-L -I " + url; + proc_info.Arguments = "-m 10 --connect-timeout 10 -L -I " + url; proc_info.UseShellExecute = false; proc_info.RedirectStandardOutput = true; proc_info.RedirectStandardError = true;