mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Recipe for Arts and Letters Daily
A recipe to pull the contents of the facing page of Arts and Letters Daily https://www.aldaily.com/
This commit is contained in:
parent
e2a0807079
commit
91f30f51aa
37
recipes/ald.recipe
Normal file
37
recipes/ald.recipe
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env python2
|
||||||
|
from __future__ import unicode_literals, division, absolute_import, print_function
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2018, PJ Paul '
|
||||||
|
|
||||||
|
'''
|
||||||
|
Recipe for Arts and Letters Daily website https://www.aldaily.com/
|
||||||
|
'''
|
||||||
|
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class ALD(BasicNewsRecipe):
|
||||||
|
title = 'Arts and Letters Daily'
|
||||||
|
oldest_article = 7
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
auto_cleanup = True
|
||||||
|
recursions = 0
|
||||||
|
ignore_duplicate_articles = {'url'}
|
||||||
|
index = 'https://www.aldaily.com/alt/'
|
||||||
|
cover_url = 'https://www.aldaily.com/static/images/header.gif'
|
||||||
|
|
||||||
|
__author__ = 'https://github.com/pjpaulpj'
|
||||||
|
language = 'en'
|
||||||
|
encoding = 'utf-8'
|
||||||
|
|
||||||
|
## Define parser for the page
|
||||||
|
def parse_index(self):
|
||||||
|
articles = []
|
||||||
|
feeds = []
|
||||||
|
soup = self.index_to_soup(self.index)
|
||||||
|
for x in soup.findAll('p'):
|
||||||
|
if x.find('a'):
|
||||||
|
title = self.tag_to_string(x)
|
||||||
|
url = x.find('a')['href']
|
||||||
|
articles.append({'title':title, 'url':url, 'description': '', 'date':''})
|
||||||
|
feeds.append(('Articles', articles))
|
||||||
|
return feeds
|
Loading…
x
Reference in New Issue
Block a user