From 19008dfdda6b8b62a9d7c70fa8388cf5cba1eec9 Mon Sep 17 00:00:00 2001 From: fireshaper Date: Tue, 18 Jun 2019 16:54:41 -0400 Subject: [PATCH] Hash for MEGA links was moved in code on site. --- Form1.Designer.cs | 105 +++++++++++++-------------- Form1.cs | 179 ++++++++++++++++++++++++++++++++-------------- bin/Debug/log.txt | 18 +++++ 3 files changed, 198 insertions(+), 104 deletions(-) create mode 100644 bin/Debug/log.txt diff --git a/Form1.Designer.cs b/Form1.Designer.cs index ef084b3..afb4bf7 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -63,10 +63,11 @@ private void InitializeComponent() this.lbComics.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lbComics.FormattingEnabled = true; - this.lbComics.Location = new System.Drawing.Point(9, 113); - this.lbComics.Margin = new System.Windows.Forms.Padding(2); + this.lbComics.ItemHeight = 16; + this.lbComics.Location = new System.Drawing.Point(12, 139); + this.lbComics.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.lbComics.Name = "lbComics"; - this.lbComics.Size = new System.Drawing.Size(402, 186); + this.lbComics.Size = new System.Drawing.Size(535, 228); this.lbComics.TabIndex = 2; this.lbComics.SelectedIndexChanged += new System.EventHandler(this.lbComics_SelectedIndexChanged); this.lbComics.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbComics_MouseDown); @@ -74,27 +75,26 @@ private void InitializeComponent() // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(10, 15); - this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label1.Location = new System.Drawing.Point(13, 18); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(251, 13); + this.label1.Size = new System.Drawing.Size(335, 17); this.label1.TabIndex = 1; this.label1.Text = "Search for a comic (leave blank for recently added):"; // // tbComicSearch // - this.tbComicSearch.Location = new System.Drawing.Point(9, 34); - this.tbComicSearch.Margin = new System.Windows.Forms.Padding(2); + this.tbComicSearch.Location = new System.Drawing.Point(12, 42); + this.tbComicSearch.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tbComicSearch.Name = "tbComicSearch"; - this.tbComicSearch.Size = new System.Drawing.Size(216, 20); + this.tbComicSearch.Size = new System.Drawing.Size(287, 22); this.tbComicSearch.TabIndex = 0; // // btnSearch // - this.btnSearch.Location = new System.Drawing.Point(228, 31); - this.btnSearch.Margin = new System.Windows.Forms.Padding(2); + this.btnSearch.Location = new System.Drawing.Point(304, 38); + this.btnSearch.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnSearch.Name = "btnSearch"; - this.btnSearch.Size = new System.Drawing.Size(56, 25); + this.btnSearch.Size = new System.Drawing.Size(75, 31); this.btnSearch.TabIndex = 1; this.btnSearch.Text = "Search"; this.btnSearch.UseVisualStyleBackColor = true; @@ -102,10 +102,10 @@ private void InitializeComponent() // // btnOpenLink // - this.btnOpenLink.Location = new System.Drawing.Point(9, 85); - this.btnOpenLink.Margin = new System.Windows.Forms.Padding(2); + this.btnOpenLink.Location = new System.Drawing.Point(12, 105); + this.btnOpenLink.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnOpenLink.Name = "btnOpenLink"; - this.btnOpenLink.Size = new System.Drawing.Size(70, 23); + this.btnOpenLink.Size = new System.Drawing.Size(93, 28); this.btnOpenLink.TabIndex = 4; this.btnOpenLink.Text = "Open Link"; this.btnOpenLink.UseVisualStyleBackColor = true; @@ -113,10 +113,10 @@ private void InitializeComponent() // // btnDownload // - this.btnDownload.Location = new System.Drawing.Point(83, 85); - this.btnDownload.Margin = new System.Windows.Forms.Padding(2); + this.btnDownload.Location = new System.Drawing.Point(111, 105); + this.btnDownload.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnDownload.Name = "btnDownload"; - this.btnDownload.Size = new System.Drawing.Size(101, 23); + this.btnDownload.Size = new System.Drawing.Size(135, 28); this.btnDownload.TabIndex = 5; this.btnDownload.Text = "Download Comic"; this.btnDownload.UseVisualStyleBackColor = true; @@ -126,20 +126,20 @@ private void InitializeComponent() // this.tbDesc.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.tbDesc.Location = new System.Drawing.Point(9, 303); - this.tbDesc.Margin = new System.Windows.Forms.Padding(2); + this.tbDesc.Location = new System.Drawing.Point(12, 373); + this.tbDesc.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.tbDesc.Name = "tbDesc"; this.tbDesc.ReadOnly = true; - this.tbDesc.Size = new System.Drawing.Size(402, 103); + this.tbDesc.Size = new System.Drawing.Size(535, 126); this.tbDesc.TabIndex = 6; this.tbDesc.Text = ""; // // btnClear // - this.btnClear.Location = new System.Drawing.Point(289, 31); - this.btnClear.Margin = new System.Windows.Forms.Padding(2); + this.btnClear.Location = new System.Drawing.Point(385, 38); + this.btnClear.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnClear.Name = "btnClear"; - this.btnClear.Size = new System.Drawing.Size(58, 25); + this.btnClear.Size = new System.Drawing.Size(77, 31); this.btnClear.TabIndex = 11; this.btnClear.Text = "Clear"; this.btnClear.UseVisualStyleBackColor = true; @@ -148,10 +148,10 @@ private void InitializeComponent() // button2 // this.button2.Image = global::Omnibus.Properties.Resources.downloads_32px; - this.button2.Location = new System.Drawing.Point(590, 10); - this.button2.Margin = new System.Windows.Forms.Padding(2); + this.button2.Location = new System.Drawing.Point(787, 12); + this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(39, 42); + this.button2.Size = new System.Drawing.Size(52, 52); this.button2.TabIndex = 13; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); @@ -159,10 +159,10 @@ private void InitializeComponent() // button1 // this.button1.Image = global::Omnibus.Properties.Resources.settings_32px; - this.button1.Location = new System.Drawing.Point(546, 10); - this.button1.Margin = new System.Windows.Forms.Padding(2); + this.button1.Location = new System.Drawing.Point(728, 12); + this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(39, 42); + this.button1.Size = new System.Drawing.Size(52, 52); this.button1.TabIndex = 12; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); @@ -173,10 +173,10 @@ private void InitializeComponent() this.pbCover.ErrorImage = global::Omnibus.Properties.Resources.omnibus_preview_image; this.pbCover.Image = global::Omnibus.Properties.Resources.omnibus_preview_image; this.pbCover.InitialImage = global::Omnibus.Properties.Resources.omnibus_preview_image; - this.pbCover.Location = new System.Drawing.Point(415, 113); - this.pbCover.Margin = new System.Windows.Forms.Padding(2); + this.pbCover.Location = new System.Drawing.Point(553, 139); + this.pbCover.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pbCover.Name = "pbCover"; - this.pbCover.Size = new System.Drawing.Size(214, 292); + this.pbCover.Size = new System.Drawing.Size(285, 359); this.pbCover.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pbCover.TabIndex = 3; this.pbCover.TabStop = false; @@ -190,11 +190,11 @@ private void InitializeComponent() this.Title, this.Status, this.Progress}); - this.lvDownloads.Location = new System.Drawing.Point(9, 410); - this.lvDownloads.Margin = new System.Windows.Forms.Padding(2); + this.lvDownloads.Location = new System.Drawing.Point(12, 505); + this.lvDownloads.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.lvDownloads.Name = "lvDownloads"; this.lvDownloads.Scrollable = false; - this.lvDownloads.Size = new System.Drawing.Size(620, 165); + this.lvDownloads.Size = new System.Drawing.Size(825, 202); this.lvDownloads.TabIndex = 14; this.lvDownloads.UseCompatibleStateImageBehavior = false; this.lvDownloads.View = System.Windows.Forms.View.Details; @@ -223,33 +223,33 @@ private void InitializeComponent() this.toolStripSeparator1, this.clearDownloads}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(164, 54); + this.contextMenuStrip1.Size = new System.Drawing.Size(192, 58); this.contextMenuStrip1.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.contextMenuStrip1_ItemClicked); // // Cancel // this.Cancel.Name = "Cancel"; - this.Cancel.Size = new System.Drawing.Size(163, 22); + this.Cancel.Size = new System.Drawing.Size(191, 24); this.Cancel.Text = "Cancel"; // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(160, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(188, 6); // // clearDownloads // this.clearDownloads.Name = "clearDownloads"; - this.clearDownloads.Size = new System.Drawing.Size(163, 22); + this.clearDownloads.Size = new System.Drawing.Size(191, 24); this.clearDownloads.Text = "Clear Downloads"; // // btnLastPage // this.btnLastPage.Enabled = false; - this.btnLastPage.Location = new System.Drawing.Point(358, 85); - this.btnLastPage.Margin = new System.Windows.Forms.Padding(2); + this.btnLastPage.Location = new System.Drawing.Point(477, 105); + this.btnLastPage.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnLastPage.Name = "btnLastPage"; - this.btnLastPage.Size = new System.Drawing.Size(23, 23); + this.btnLastPage.Size = new System.Drawing.Size(31, 28); this.btnLastPage.TabIndex = 15; this.btnLastPage.Text = "<"; this.btnLastPage.UseVisualStyleBackColor = true; @@ -258,10 +258,10 @@ private void InitializeComponent() // btnNextPage // this.btnNextPage.Enabled = false; - this.btnNextPage.Location = new System.Drawing.Point(386, 85); - this.btnNextPage.Margin = new System.Windows.Forms.Padding(2); + this.btnNextPage.Location = new System.Drawing.Point(515, 105); + this.btnNextPage.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnNextPage.Name = "btnNextPage"; - this.btnNextPage.Size = new System.Drawing.Size(23, 23); + this.btnNextPage.Size = new System.Drawing.Size(31, 28); this.btnNextPage.TabIndex = 16; this.btnNextPage.Text = ">"; this.btnNextPage.UseVisualStyleBackColor = true; @@ -269,23 +269,24 @@ private void InitializeComponent() // // cmsComics // + this.cmsComics.ImageScalingSize = new System.Drawing.Size(20, 20); this.cmsComics.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.search}); this.cmsComics.Name = "cmsComics"; - this.cmsComics.Size = new System.Drawing.Size(186, 26); + this.cmsComics.Size = new System.Drawing.Size(211, 56); this.cmsComics.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.cmsComics_ItemClicked); // // search // this.search.Name = "search"; - this.search.Size = new System.Drawing.Size(185, 22); - this.search.Text = "Search for this comic"; + this.search.Size = new System.Drawing.Size(210, 24); + this.search.Text = "Find more like this"; // // Form1 // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(637, 582); + this.ClientSize = new System.Drawing.Size(849, 716); this.Controls.Add(this.btnNextPage); this.Controls.Add(this.btnLastPage); this.Controls.Add(this.lvDownloads); @@ -301,7 +302,7 @@ private void InitializeComponent() this.Controls.Add(this.label1); this.Controls.Add(this.lbComics); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(2); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.pbCover)).EndInit(); diff --git a/Form1.cs b/Form1.cs index d93239d..2e779e8 100644 --- a/Form1.cs +++ b/Form1.cs @@ -161,7 +161,8 @@ private void btnDownload_Click(object sender, EventArgs e) HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(data); - Regex regex = new Regex("(?<=go.php-url=)(.*)Mega", RegexOptions.IgnoreCase); + //Regex regex = new Regex("(?<=go.php-url=)(.*)Mega", RegexOptions.IgnoreCase); //old regex string + Regex regex = new Regex("(?<=go.php-urls/)(.*)Mega", RegexOptions.IgnoreCase); //updated regex string to match new paths Match match; if (regex.Match(data).Success != false) @@ -176,7 +177,46 @@ private void btnDownload_Click(object sender, EventArgs e) string[] g1 = group.ToString().Split(new string[] { " n.HasClass("pagination-newer")); - var opNodes = doc.DocumentNode.Descendants(0).Where(n => n.HasClass("pagination-older")); + var npNodes = doc.DocumentNode.Descendants(0).Where(n => n.HasClass("pagination-newer")); + var opNodes = doc.DocumentNode.Descendants(0).Where(n => n.HasClass("pagination-older")); - if (opNodes.Count() > 0) - { - btnNextPage.Enabled = true; - } - else - { - btnNextPage.Enabled = false; - } + if (opNodes.Count() > 0) + { + btnNextPage.Enabled = true; + } + else + { + btnNextPage.Enabled = false; + } - if (npNodes.Count() > 0) - { - btnLastPage.Enabled = true; - } - else - { - btnLastPage.Enabled = false; - } + if (npNodes.Count() > 0) + { + btnLastPage.Enabled = true; + } + else + { + btnLastPage.Enabled = false; + } - nodes = doc.DocumentNode.Descendants(0).Where(n => n.HasClass("post-header-image")); + nodes = doc.DocumentNode.Descendants(0).Where(n => n.HasClass("post-header-image")); - foreach (HtmlNode n in nodes) - { - string node = n.InnerHtml; - string[] a = node.Split('"'); + foreach (HtmlNode n in nodes) + { + string node = n.InnerHtml; + string[] a = node.Split('"'); - string title = replaceASCII(a[5]); + string title = replaceASCII(a[5]); - lbComics.Items.Add(title); - } + lbComics.Items.Add(title); + } - descNodes = doc.DocumentNode.Descendants(0).Where(n => n.HasClass("post-info")); - } - else - { - MessageBox.Show("There was an error. Try again in a couple of minnutes."); + descNodes = doc.DocumentNode.Descendants(0).Where(n => n.HasClass("post-info")); + } + else + { + MessageBox.Show("There was an error. Try again in a couple of minnutes."); + } } } + + private void LogWriter(string line) + { + string datetime = DateTime.Now.ToString("MM-dd-yy HH:mm:ss"); + File.AppendAllText(@"log.txt", "(" + datetime + ") - " + line + Environment.NewLine); + } } } \ No newline at end of file diff --git a/bin/Debug/log.txt b/bin/Debug/log.txt new file mode 100644 index 0000000..10c01dd --- /dev/null +++ b/bin/Debug/log.txt @@ -0,0 +1,18 @@ +(12-17-18 15:30:33)System.Net.WebException: The request was aborted: The connection was closed unexpectedly. + at System.Net.HttpWebRequest.GetResponse() + at Omnibus.Form1.searchComics(String function) in C:\Users\rory5\source\repos\Omnibus\Comic Search\Form1.cs:line 618 +(12-17-18 15:31:28) - System.Net.WebException: The request was aborted: The connection was closed unexpectedly. + at System.Net.HttpWebRequest.GetResponse() + at Omnibus.Form1.searchComics(String function) in C:\Users\rory5\source\repos\Omnibus\Comic Search\Form1.cs:line 618 +(12-17-18 15:33:57) - Searching for https://getcomics.info/page/4/?s=Adventure Time Season 11 #2 failed. +(12-17-18 15:33:57) - System.Net.WebException: The request was aborted: The connection was closed unexpectedly. + at System.Net.HttpWebRequest.GetResponse() + at Omnibus.Form1.searchComics(String function) in C:\Users\rory5\source\repos\Omnibus\Comic Search\Form1.cs:line 618 +(12-17-18 15:34:16) - Searching for https://getcomics.info/page/4/?s=Head Lopper #10 failed. +(12-17-18 15:34:16) - System.Net.WebException: The request was aborted: The connection was closed unexpectedly. + at System.Net.HttpWebRequest.GetResponse() + at Omnibus.Form1.searchComics(String function) in C:\Users\rory5\source\repos\Omnibus\Comic Search\Form1.cs:line 618 +(12-17-18 15:35:43) - Searching for https://getcomics.info/page/4/?s=Head Lopper failed. +(12-17-18 15:35:43) - System.Net.WebException: The request was aborted: The connection was closed unexpectedly. + at System.Net.HttpWebRequest.GetResponse() + at Omnibus.Form1.searchComics(String function) in C:\Users\rory5\source\repos\Omnibus\Comic Search\Form1.cs:line 619