From 9c4fccc14c005bd71dee0a26f32eb09b2589bcda Mon Sep 17 00:00:00 2001 From: kshib Date: Sun, 14 Apr 2024 21:23:07 +0530 Subject: [PATCH] hide ads --- lib/extractor/general/national/india/theindianexpress.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/extractor/general/national/india/theindianexpress.dart b/lib/extractor/general/national/india/theindianexpress.dart index b78b9fb..c878427 100644 --- a/lib/extractor/general/national/india/theindianexpress.dart +++ b/lib/extractor/general/national/india/theindianexpress.dart @@ -50,6 +50,10 @@ class TheIndianExpress extends Publisher { if (response.statusCode == 200) { Document document = html_parser.parse(utf8.decode(response.bodyBytes)); var content = document.querySelector("#pcl-full-content")?.innerHtml ?? ""; + var ads = ".osv-ad-class,.ad-slot,.subscriber_hide,.adboxtop,.pdsc-related-modify"; + document.querySelectorAll(ads).forEach((ad) { + content = content.replaceAll(ad.innerHtml, ""); + },); var thumbnail = document.querySelector(".custom-caption img")?.attributes["content"]; var excerpt = document.querySelector(".synopsis")?.text; var timestamp = document.querySelector("span[itemprop=dateModified]")?.attributes["content"]; @@ -96,7 +100,7 @@ class TheIndianExpress extends Publisher { timestamp = timestamp.contains("Updated:")?timestamp.split("Updated:")[1].trim():timestamp; articles.add(NewsArticle( publisher: this, - title: title ?? "", + title: title, content: "", excerpt: excerpt, author: "",