Is there any free scrape package/too etc in python which can crawle a wordpress site and skip the ad block

social_newbie

Power Member
Premium Member
Joined
Nov 4, 2023
Messages
599
Reaction score
159
I want to keep the orignal html , only remove the ad block
Is there any existing solution for this purpose?
 
Not sure of a pre built library... Newspaper is ok from Python but it hasn't been updated in years so YMMV.

Most WordPress sites don't disable access to the wp-json V2 API so if you want to get rid of a lot of website fluff be and make less requests to the server, just put
wp-json/wp/v2/posts (or pages)
At the end of the homepage URL and you'll be able to see everything. You can read more about it following the WordPress WP Json API documentation.

Hope this helps.
 
Not sure of a pre built library... Newspaper is ok from Python but it hasn't been updated in years so YMMV.

Most WordPress sites don't disable access to the wp-json V2 API so if you want to get rid of a lot of website fluff be and make less requests to the server, just put
wp-json/wp/v2/posts (or pages)
At the end of the homepage URL and you'll be able to see everything. You can read more about it following the WordPress WP Json API documentation.

Hope this helps.
Thanks very much, will try later on
 
Inspect am element with ad in console, find element with beautiful soup and use decompose() method. It removes a tag from the tree, then completely destroys it and its contents.
 
You can use libraries like BeautifulSoup with requests or Scrapy for scraping WordPress sites, and remove ad blocks by targeting specific HTML elements or classes associated with ads. Combining html.parser with custom filtering logic should help you keep the original HTML structure while removing ad blocks.
 
Back
Top