Today we are pleased to announce the release of our Article Extractor API! When recommending content it's important to ensure you are only recommending for the relevant text of an article. We have often faced this challenge with online articles and blogs. We'd want to fetch a URL but just extract the main body of text, no headers, footers, sidebars or anything like that. We developed an internal API that we used for things like NewsBot and the news recommender. We've had a lot of people interested in using it. So, having polished the code a bit, we're now releasing the API to the public!
The API takes a URL of a blog or article and then extracts the title, author, date published, image, videos, keywords, meta description and the article body. It's worth noting that whilst the article extraction works most of the time, there are some cases when it doesn't work. For example, sometimes paywalls can trip up the system and sometimes it simply doesn't find the right body of text.
When the API encounters a new URL, the contents of the remote page have to be fetched. This can be time consuming because remote servers can be slow. Due to this we cache previously seen URLs responses for 1 day. If a cached copy has expired the remote page is fetched again. Also because of this overhead requests to the API can take several seconds. To combat this we've enabled a rate limit of 1 request per second. There are several instances of the API running behind a load balancer to ensure reliability.
The main 'heavy lifting' of extracting useful information and detecting the main body of text is done by two Python packages, python-goose and Newspaper. Massive thanks to the creators of these because they work really well! Our aim in releasing the API is to let anyone quickly make use of our infrastructure, caching and reliability for a reasonable price. If you are interested in creating your own version I would highly recommend using the above mentioned packages!
The API has one endpoint where you send a GET request with the url parameter. Please have a look at the API specification for more detail. The response is an JSON object something like this:
"title": "Press me! The buttons that lie to you",
"author": "Chris Baraniuk",
"keywords": ["control", "lie", "button", "system", "effect", "buttons", [...]],
"description": "Does it help to push the buttons on pedestrian crossings, [...]",
"body": "The tube pulls in to a busy station along the London Underground’s [...]"
Note: the keywords, description and body fields were truncated for display purposes.
If you're interested, the API is online and ready to be tried out! Please let us know any feedback or if you come across any issues.
How to create a VHD that is fully compatible with Azure from an Ubuntu Cloud Image base.
In this blog post, I will create a Chrome extension that modifies this blog to set a custom background and to modify the HTML