-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Next/Previous Chapter buttons on WuxiaWorld
- Loading branch information
Showing
3 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters