Skip to content

Commit

Permalink
Added additional filtering for AllNovelProvider (#246)
Browse files Browse the repository at this point in the history
Now filtering out the iframe created by an advertisement
Also filtering out other report phrase
  • Loading branch information
TrimVis authored Jun 7, 2024
1 parent 70b04bc commit 2e2eaec
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
/.idea/deploymentTargetSelector.xml
/.idea/kotlinc.xml
/.idea/misc.xml
.DS_Store
/build
/captures
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,22 @@ open class AllNovelProvider : MainAPI() {

override suspend fun loadHtml(url: String): String? {
val document = app.get(url).document
return (document.selectFirst("#chapter-content")
?: document.selectFirst("#chr-content"))?.html()?.replace(
" If you find any errors ( broken links, non-standard content, etc.. ), Please let us know < report chapter > so we can fix it as soon as possible.",
" "
)?.replace("[Updated from F r e e w e b n o v e l. c o m]", "")
val content = (document.selectFirst("#chapter-content")
?: document.selectFirst("#chr-content"))
if (content == null) return null

return content.html()
.replace(
"<iframe .* src=\"//ad.{0,2}-ads.com/.*\" style=\".*\"></iframe>".toRegex(),
" "
).replace(
" If you find any errors ( broken links, non-standard content, etc.. ), Please let us know &lt; report chapter &gt; so we can fix it as soon as possible.",
" "
).replace(
"If you find any errors ( Ads popup, ads redirect, broken links, non-standard content, etc.. ), Please let us know &lt; report chapter &gt; so we can fix it as soon as possible.",
" "
).replace("[Updated from F r e e w e b n o v e l. c o m]", "")

}

override suspend fun search(query: String): List<SearchResponse> {
Expand Down

0 comments on commit 2e2eaec

Please sign in to comment.