mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
54 lines
1.8 KiB
Plaintext
54 lines
1.8 KiB
Plaintext
|
|
__license__ = 'GPL v3'
|
|
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
|
'''
|
|
www.army.mil/soldiers/
|
|
'''
|
|
|
|
from calibre.web.feeds.news import BasicNewsRecipe
|
|
|
|
class Soldiers(BasicNewsRecipe):
|
|
title = 'Soldiers'
|
|
__author__ = 'Darko Miletic'
|
|
description = 'The Official U.S. Army Magazine'
|
|
oldest_article = 30
|
|
max_articles_per_feed = 100
|
|
no_stylesheets = True
|
|
use_embedded_content = False
|
|
auto_cleanup = True
|
|
auto_cleanup_keep = '//div[@id="mediaWrapper"]'
|
|
simultaneous_downloads = 1
|
|
delay = 4
|
|
max_connections = 1
|
|
encoding = 'utf-8'
|
|
publisher = 'U.S. Army'
|
|
category = 'news, politics, war, weapons'
|
|
language = 'en'
|
|
INDEX = 'http://www.army.mil/soldiers/'
|
|
|
|
conversion_options = {
|
|
'comment' : description
|
|
, 'tags' : category
|
|
, 'publisher' : publisher
|
|
, 'language' : language
|
|
}
|
|
|
|
#keep_only_tags = [dict(name='div', attrs={'id':['storyHeader','textArea']})]
|
|
|
|
#remove_tags = [
|
|
#dict(name='div', attrs={'id':['addThis','comment','articleFooter']})
|
|
#,dict(name=['object','link'])
|
|
#]
|
|
|
|
feeds = [(u'Frontpage', u'http://www.army.mil/rss/2/' )]
|
|
|
|
|
|
def get_cover_url(self):
|
|
cover_url = None
|
|
soup = self.index_to_soup(self.INDEX)
|
|
cover_item = soup.find('img',attrs={'alt':'Current Magazine Cover'})
|
|
if cover_item:
|
|
cover_url = cover_item['src']
|
|
return cover_url
|
|
|