Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

Commit

Permalink
added button for magnet and torrent files
Browse files Browse the repository at this point in the history
  • Loading branch information
dreanor committed May 9, 2017
1 parent 187c153 commit e75237b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
28 changes: 18 additions & 10 deletions TorrentBrowser/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,13 @@ public Form1()
InitializeComponent();
}

private void downloadCurrentSearchToolStripMenuItem_Click(object sender, EventArgs e)
{
string sourcePage = webBrowser1.DocumentText;

List<string> torrents = GetTorrents(sourcePage);
DownloadTorrents(torrents);
}

private static List<string> GetTorrents(string sourcePage)
private static List<string> GetTorrents(string sourcePage, string searchTerm)
{
List<string> torrents = new List<string>();
int index = 0;
do
{
index = sourcePage.IndexOf("magnet:?", index);
index = sourcePage.IndexOf(searchTerm, index);
if (index != -1)
{
var endOfMagnetLink = sourcePage.IndexOf("\"", index);
Expand Down Expand Up @@ -56,5 +48,21 @@ private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Navigate("https://nyaa.pantsu.cat/search?c=3_5&s=&sort=torrent_id&order=desc&max=300&q=");
}

private void torrentFileToolStripMenuItem_Click(object sender, EventArgs e)
{
string sourcePage = webBrowser1.DocumentText;

List<string> torrents = GetTorrents(sourcePage, "http://anicache.com");
DownloadTorrents(torrents);
}

private void downloadCurrentSearchToolStripMenuItem_Click(object sender, EventArgs e)
{
string sourcePage = webBrowser1.DocumentText;

List<string> torrents = GetTorrents(sourcePage, "magnet:?");
DownloadTorrents(torrents);
}
}
}
15 changes: 12 additions & 3 deletions TorrentBrowser/Form1.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions TorrentBrowser/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]

0 comments on commit e75237b

Please sign in to comment.