Skip to content

Commit

Permalink
Remove Next/Previous Chapter buttons on WuxiaWorld
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitch528 committed Jan 17, 2016
1 parent 22b3a28 commit 0ac0ef8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions WebNovelConverter/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ private void MainForm_Load(object sender, EventArgs e)
{
_sources.Add(new RoyalRoadL());
_sources.Add(new BakaTsukiSource());
_sources.Add(new WuxiaWorldSource());
}

private void retrieveButton_Click(object sender, EventArgs e)
Expand Down
35 changes: 35 additions & 0 deletions WebNovelConverter/Sources/WuxiaWorldSource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Linq;
using AngleSharp.Dom;
using AngleSharp.Extensions;

namespace WebNovelConverter.Sources
{
public class WuxiaWorldSource : WordPressSource
{
public override string BaseUrl => "http://wuxiaworld.com/";

private static readonly string[] LinksToRemove =
{
"Next Chapter",
"Previous Chapter"
};

protected override void RemoveBloat(IElement element)
{
base.RemoveBloat(element);

var toRemove = (from p in element.Descendents<IElement>()
where p.LocalName == "p"
from link in p.Descendents<IElement>()
where link.LocalName == "a"
where LinksToRemove.Any(x => x == link.Text().Trim())
select link).ToList();

foreach (IElement e in toRemove)
{
e.Remove();
}
}
}
}
1 change: 1 addition & 0 deletions WebNovelConverter/WebNovelConverter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
<Compile Include="Sources\RoyalRoadL.cs" />
<Compile Include="Sources\WebNovelSource.cs" />
<Compile Include="Sources\WordPressSource.cs" />
<Compile Include="Sources\WuxiaWorldSource.cs" />
<Compile Include="UrlHelper.cs" />
<Compile Include="WebNovelChapter.cs" />
<EmbeddedResource Include="MainForm.resx">
Expand Down

0 comments on commit 0ac0ef8

Please sign in to comment.