From 7c0e77ffad7fb9566b4fe8ee260a831602faa4c8 Mon Sep 17 00:00:00 2001 From: Michael Salaverry Date: Sat, 17 Dec 2022 16:53:07 +0200 Subject: [PATCH] add new recipe: works in progress magazine --- recipes/works_in_progress.recipe | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 recipes/works_in_progress.recipe diff --git a/recipes/works_in_progress.recipe b/recipes/works_in_progress.recipe new file mode 100644 index 0000000000..bd5a6dfafd --- /dev/null +++ b/recipes/works_in_progress.recipe @@ -0,0 +1,37 @@ +#!/usr/bin/env python +# vim:fileencoding=utf-8 +from calibre.web.feeds.news import BasicNewsRecipe + +class WorksInProgress(BasicNewsRecipe): + title = 'Works in progress' + description = 'Works in Progress is an online magazine dedicated to sharing new and underrated ideas to improve the world, and features original writing from some of the most interesting thinkers in the world' + cover_url = "https://www.worksinprogress.co/wp-content/uploads/2020/03/logo-1.svg" + oldest_article = 7 + max_articles_per_feed = 100 + auto_cleanup = True + publication_type = 'magazine' + language = 'en' + index = "https://www.worksinprogress.co/" + __author__ = "barakplasma" + + def parse_index(self): + soup = self.index_to_soup(self.index) + feeds = [] + + for section in soup.find_all('div', 'issue-loop'): + section_title = section['data-section-id'] + section_items = [] + + for article in section.find_all('div', 'issue-intro'): + title = article.find('h2', 'issue-title').text + url = article.find_all('a')[1]['href'] + author = article.find('a', 'author').text + section_items.append({ + "title": title, + "url": url, + "author": author + }) + + feeds.append((section_title, section_items)) + + return feeds \ No newline at end of file