mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Oil Price by Darko Miletic
This commit is contained in:
parent
22dbc9c91a
commit
d82ad7af94
@ -27,15 +27,30 @@ class NYTimes(BasicNewsRecipe):
|
|||||||
'Home','Styles','Sunday Business','Week In Review','Travel','Magazine',
|
'Home','Styles','Sunday Business','Week In Review','Travel','Magazine',
|
||||||
'Book Review','Weddings','Real Estate','Automobiles',"T Men's Fashion",
|
'Book Review','Weddings','Real Estate','Automobiles',"T Men's Fashion",
|
||||||
"T Women's Fashion"]
|
"T Women's Fashion"]
|
||||||
excludeSectionKeywords = ['Dining','Weddings']
|
|
||||||
|
|
||||||
test_mode = False
|
# List of sections to exclude
|
||||||
if test_mode:
|
# To add a section, copy the section name from the allSectionKeywords list above
|
||||||
all = set(allSectionKeywords)
|
# For example, to exclude 'Dining' and 'Weddings':
|
||||||
fetch_only = set(['The Front Page'])
|
# excludeSectionKeywords = ['Dining','Weddings']
|
||||||
excludeSectionKeywords = list(all ^ fetch_only)
|
excludeSectionKeywords = []
|
||||||
|
|
||||||
|
# List of sections to include (test and debug only)
|
||||||
|
# By default, any sections in today's paper that are not listed in excludeSectionKeywords
|
||||||
|
# are downloaded. fetch_only specifies that only certain sections are to be downloaded.
|
||||||
|
# This should only be used for testing and debugging.
|
||||||
|
# For example, to download only 'The Front Page' section:
|
||||||
|
# fetch_only = set(['The Front Page'])
|
||||||
|
fetch_only = set([])
|
||||||
|
if fetch_only:
|
||||||
|
excludeSectionKeywords = list(set(allSectionKeywords) ^ fetch_only)
|
||||||
|
|
||||||
|
# one_picture_per_article specifies that calibre should only use the first image
|
||||||
|
# from an article (if one exists). If one_picture_per_article = True, the image
|
||||||
|
# will be moved to a location between the headline and the byline.
|
||||||
|
# If one_picture_per_article = False, all images from the article will be included
|
||||||
|
# and shown in their original location.
|
||||||
|
one_picture_per_article = True
|
||||||
|
|
||||||
use_one_picture_per_article = True
|
|
||||||
timefmt = ''
|
timefmt = ''
|
||||||
needs_subscription = True
|
needs_subscription = True
|
||||||
remove_tags_before = dict(id='article')
|
remove_tags_before = dict(id='article')
|
||||||
@ -45,6 +60,7 @@ class NYTimes(BasicNewsRecipe):
|
|||||||
'columnGroup doubleRule',
|
'columnGroup doubleRule',
|
||||||
'columnGroup last',
|
'columnGroup last',
|
||||||
'doubleRule',
|
'doubleRule',
|
||||||
|
'dottedLine',
|
||||||
'entry-meta',
|
'entry-meta',
|
||||||
'icon enlargeThis',
|
'icon enlargeThis',
|
||||||
'leftNavTabs',
|
'leftNavTabs',
|
||||||
@ -78,7 +94,7 @@ class NYTimes(BasicNewsRecipe):
|
|||||||
'toolsRight',
|
'toolsRight',
|
||||||
]),
|
]),
|
||||||
dict(name=['script', 'noscript', 'style'])]
|
dict(name=['script', 'noscript', 'style'])]
|
||||||
#encoding = 'utf-8'
|
masthead_url = 'http://graphics8.nytimes.com/images/misc/nytlogo379x64.gif'
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
extra_css = '.headline {text-align: left;}\n \
|
extra_css = '.headline {text-align: left;}\n \
|
||||||
.byline {font-family: monospace; \
|
.byline {font-family: monospace; \
|
||||||
@ -118,11 +134,6 @@ class NYTimes(BasicNewsRecipe):
|
|||||||
|
|
||||||
return br
|
return br
|
||||||
|
|
||||||
masthead_url = 'http://graphics8.nytimes.com/images/misc/nytlogo379x64.gif'
|
|
||||||
|
|
||||||
def get_masthead_title(self):
|
|
||||||
return 'NYTimes GR Version'
|
|
||||||
|
|
||||||
def get_cover_url(self):
|
def get_cover_url(self):
|
||||||
cover = None
|
cover = None
|
||||||
st = time.localtime()
|
st = time.localtime()
|
||||||
@ -138,6 +149,9 @@ class NYTimes(BasicNewsRecipe):
|
|||||||
cover = None
|
cover = None
|
||||||
return cover
|
return cover
|
||||||
|
|
||||||
|
def get_masthead_title(self):
|
||||||
|
return 'NYTimes GR Version'
|
||||||
|
|
||||||
def dump_ans(self, ans):
|
def dump_ans(self, ans):
|
||||||
total_article_count = 0
|
total_article_count = 0
|
||||||
for section in ans :
|
for section in ans :
|
||||||
@ -163,9 +177,6 @@ class NYTimes(BasicNewsRecipe):
|
|||||||
print result
|
print result
|
||||||
|
|
||||||
def fixChars(self,string):
|
def fixChars(self,string):
|
||||||
# Something's not right in the pipeline
|
|
||||||
#
|
|
||||||
|
|
||||||
# Replace lsquo (\x91)
|
# Replace lsquo (\x91)
|
||||||
fixed = re.sub("\x91","‘",string)
|
fixed = re.sub("\x91","‘",string)
|
||||||
|
|
||||||
@ -260,16 +271,6 @@ class NYTimes(BasicNewsRecipe):
|
|||||||
self.dump_ans(ans)
|
self.dump_ans(ans)
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
def strip_anchors(self,soup):
|
|
||||||
paras = soup.findAll(True)
|
|
||||||
for para in paras:
|
|
||||||
aTags = para.findAll('a')
|
|
||||||
for a in aTags:
|
|
||||||
if a.img is None:
|
|
||||||
a.replaceWith(a.renderContents().decode('utf-8','replace'))
|
|
||||||
#a.replaceWith(a.renderContents().decode('cp1252','replace'))
|
|
||||||
return soup
|
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
'''
|
'''
|
||||||
refresh = soup.find('meta', {'http-equiv':'refresh'})
|
refresh = soup.find('meta', {'http-equiv':'refresh'})
|
||||||
@ -283,7 +284,7 @@ class NYTimes(BasicNewsRecipe):
|
|||||||
|
|
||||||
def postprocess_html(self,soup, True):
|
def postprocess_html(self,soup, True):
|
||||||
|
|
||||||
if self.use_one_picture_per_article:
|
if self.one_picture_per_article:
|
||||||
# Remove all images after first
|
# Remove all images after first
|
||||||
largeImg = soup.find(True, {'class':'articleSpanImage'})
|
largeImg = soup.find(True, {'class':'articleSpanImage'})
|
||||||
inlineImgs = soup.findAll(True, {'class':'inlineImage module'})
|
inlineImgs = soup.findAll(True, {'class':'inlineImage module'})
|
||||||
@ -462,3 +463,13 @@ class NYTimes(BasicNewsRecipe):
|
|||||||
if article.description is None :
|
if article.description is None :
|
||||||
article.description = extract_description(article.href)
|
article.description = extract_description(article.href)
|
||||||
|
|
||||||
|
def strip_anchors(self,soup):
|
||||||
|
paras = soup.findAll(True)
|
||||||
|
for para in paras:
|
||||||
|
aTags = para.findAll('a')
|
||||||
|
for a in aTags:
|
||||||
|
if a.img is None:
|
||||||
|
a.replaceWith(a.renderContents().decode('utf-8','replace'))
|
||||||
|
#a.replaceWith(a.renderContents().decode('cp1252','replace'))
|
||||||
|
return soup
|
||||||
|
|
||||||
|
34
resources/recipes/oilprice.recipe
Normal file
34
resources/recipes/oilprice.recipe
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
|
'''
|
||||||
|
oilprice.com
|
||||||
|
'''
|
||||||
|
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class OilPrice(BasicNewsRecipe):
|
||||||
|
title = 'Oil Price'
|
||||||
|
__author__ = 'Darko Miletic'
|
||||||
|
description = 'The nr. 1 source for Oil Price Information'
|
||||||
|
publisher = 'oilprice.com'
|
||||||
|
category = 'news, oil, politics, world, usa'
|
||||||
|
oldest_article = 2
|
||||||
|
max_articles_per_feed = 200
|
||||||
|
no_stylesheets = True
|
||||||
|
encoding = 'cp1252'
|
||||||
|
use_embedded_content = False
|
||||||
|
language = 'en'
|
||||||
|
country = 'US'
|
||||||
|
extra_css = ' body{font-family: Arial,Helvetica,sans-serif } img{margin-bottom: 0.4em} '
|
||||||
|
|
||||||
|
conversion_options = {
|
||||||
|
'comment' : description
|
||||||
|
, 'tags' : category
|
||||||
|
, 'publisher' : publisher
|
||||||
|
, 'language' : language
|
||||||
|
}
|
||||||
|
remove_tags = [dict(name='div',attrs={'class':'banner'})]
|
||||||
|
keep_only_tags = [dict(name='div',attrs={'id':'storyContent'})]
|
||||||
|
remove_tags_after = dict(attrs={'id':'KonaBody'})
|
||||||
|
|
||||||
|
feeds = [(u'Articles', u'http://www.oilprice.com/rss.xml')]
|
@ -6521,7 +6521,7 @@ msgstr "<p>Za pomoć vidi: <a href=\"%s\">Korisničko uputstvo</a><br>"
|
|||||||
|
|
||||||
#: /home/kovid/work/calibre/src/calibre/gui2/ui.py:226
|
#: /home/kovid/work/calibre/src/calibre/gui2/ui.py:226
|
||||||
msgid "<b>%s</b>: %s by <b>Kovid Goyal %%(version)s</b><br>%%(device)s</p>"
|
msgid "<b>%s</b>: %s by <b>Kovid Goyal %%(version)s</b><br>%%(device)s</p>"
|
||||||
msgstr "<b>%s</b>: %s autor <b>Kovid Goyal %%(version)</b><br>%%(device)</p>"
|
msgstr "<b>%s</b>: %s autor <b>Kovid Goyal %%(version)s</b><br>%%(device)s</p>"
|
||||||
|
|
||||||
#: /home/kovid/work/calibre/src/calibre/gui2/ui.py:249
|
#: /home/kovid/work/calibre/src/calibre/gui2/ui.py:249
|
||||||
msgid "Edit metadata individually"
|
msgid "Edit metadata individually"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user