Skip to content

Commit

Permalink
Changes to userAgent string
Browse files Browse the repository at this point in the history
  • Loading branch information
fireshaper committed Mar 17, 2024
1 parent 5708947 commit e34bbac
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 5 deletions.
48 changes: 43 additions & 5 deletions Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Omnibus
public partial class Form1 : Form
{

private String version = "1.5.1";
private String version = "1.5.3.1";
private String url = "https://getcomics.info/?s=";
private int cancelled = 0;
private bool isDownloading = false;
Expand All @@ -33,6 +33,8 @@ public partial class Form1 : Form
public int LVCount = 0;
private int page = 1;

string userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0";

private object comicIndex;

private IEnumerable<HtmlNode> nodes, descNodes, ulNodes, newpageNodes, oldpageNodes;
Expand Down Expand Up @@ -188,7 +190,9 @@ private async void btnDownload_ClickAsync(object sender, EventArgs e)
string[] a = node.Split('"');

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(a[1]);
request.UserAgent = Properties.Settings.Default.UserAgent;
//request.UserAgent = Properties.Settings.Default.UserAgent;
request.UserAgent = userAgent;
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8";
request.Headers.Add(HttpRequestHeader.Cookie,
"__cfduid=" + Properties.Settings.Default.cfduid + ";" +
"cf_clearance=" + Properties.Settings.Default.cf_clearance
Expand Down Expand Up @@ -343,6 +347,14 @@ private async void btnDownload_ClickAsync(object sender, EventArgs e)


}
else
{

var statusCode = response.StatusCode;
var statusDesc = response.StatusDescription;

MessageBox.Show("Error: " + statusCode + ": " + statusDesc);
}
}
}
else
Expand Down Expand Up @@ -750,7 +762,9 @@ private void cmsComics_ItemClicked(object sender, ToolStripItemClickedEventArgs
string[] a = node.Split('"');

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(a[1]);
request.UserAgent = Properties.Settings.Default.UserAgent;
//request.UserAgent = Properties.Settings.Default.UserAgent;
request.UserAgent = userAgent;
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8";
request.Headers.Add(HttpRequestHeader.Cookie,
"__cfduid=" + Properties.Settings.Default.cfduid + ";" +
"cf_clearance=" + Properties.Settings.Default.cf_clearance
Expand Down Expand Up @@ -850,6 +864,14 @@ private void cmsComics_ItemClicked(object sender, ToolStripItemClickedEventArgs
else
MessageBox.Show("No download link available. Go to comic's page and download manually.");
}
else
{

var statusCode = response.StatusCode;
var statusDesc = response.StatusDescription;

MessageBox.Show("Error: " + statusCode + ": " + statusDesc);
}
}
if (e.ClickedItem.Name == "validateMF")
{
Expand All @@ -858,7 +880,9 @@ private void cmsComics_ItemClicked(object sender, ToolStripItemClickedEventArgs
string[] a = node.Split('"');

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(a[1]);
request.UserAgent = Properties.Settings.Default.UserAgent;
//request.UserAgent = Properties.Settings.Default.UserAgent;
request.UserAgent = userAgent;
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8";
request.Headers.Add(HttpRequestHeader.Cookie,
"__cfduid=" + Properties.Settings.Default.cfduid + ";" +
"cf_clearance=" + Properties.Settings.Default.cf_clearance
Expand Down Expand Up @@ -958,6 +982,14 @@ private void cmsComics_ItemClicked(object sender, ToolStripItemClickedEventArgs
else
MessageBox.Show("No download link available. Go to comic's page and download manually.");
}
else
{

var statusCode = response.StatusCode;
var statusDesc = response.StatusDescription;

MessageBox.Show("Error: " + statusCode + ": " + statusDesc);
}
}
}

Expand Down Expand Up @@ -1120,8 +1152,14 @@ private void searchComics(string function)
reqCookies.Add(cookieCfClearance);

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(searchURL);
request.UserAgent = Properties.Settings.Default.UserAgent;
//request.UserAgent = Properties.Settings.Default.UserAgent;
request.UserAgent = userAgent;
request.CookieContainer = reqCookies;
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8";
request.Headers.Add(HttpRequestHeader.Cookie,
"__cfduid=" + Properties.Settings.Default.cfduid + ";" +
"cf_clearance=" + Properties.Settings.Default.cf_clearance
);

//request.Headers.Add(HttpRequestHeader.Cookie,
// "__cfduid=" + Properties.Settings.Default.cfduid + ";" +
Expand Down
Binary file added bin/Debug/Catians #1 (2023).cbr
Binary file not shown.
Binary file modified bin/Debug/Omnibus.exe
Binary file not shown.
Binary file modified bin/Debug/Omnibus.pdb
Binary file not shown.
Binary file added bin/Debug/Petrol Head #5 (2024).cbr
Binary file not shown.
Binary file added bin/Debug/The One Hand #2 (2024).cbr
Binary file not shown.
Binary file modified obj/Debug/Omnibus.exe
Binary file not shown.
Binary file modified obj/Debug/Omnibus.pdb
Binary file not shown.
Binary file modified obj/Release/DesignTimeResolveAssemblyReferences.cache
Binary file not shown.
Binary file modified obj/Release/Omnibus.exe
Binary file not shown.
Binary file modified obj/Release/Omnibus.pdb
Binary file not shown.

0 comments on commit e34bbac

Please sign in to comment.