mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Kovid's 6.18 changes
This commit is contained in:
commit
6767cb547f
@ -9,9 +9,9 @@ dist
|
|||||||
docs
|
docs
|
||||||
resources/localization
|
resources/localization
|
||||||
resources/images.qrc
|
resources/images.qrc
|
||||||
resources/recipes.pickle
|
|
||||||
resources/scripts.pickle
|
resources/scripts.pickle
|
||||||
resources/ebook-convert-complete.pickle
|
resources/ebook-convert-complete.pickle
|
||||||
|
resources/builtin_recipes.xml
|
||||||
setup/installer/windows/calibre/build.log
|
setup/installer/windows/calibre/build.log
|
||||||
src/calibre/translations/.errors
|
src/calibre/translations/.errors
|
||||||
src/cssutils/.svn/
|
src/cssutils/.svn/
|
||||||
|
2
README
2
README
@ -15,3 +15,5 @@ bzr branch lp:calibre
|
|||||||
To update your copy of the source code:
|
To update your copy of the source code:
|
||||||
bzr merge
|
bzr merge
|
||||||
|
|
||||||
|
Tarballs of the source code for each release are now available \
|
||||||
|
at http://code.google.com/p/calibre-ebook
|
||||||
|
BIN
resources/images/news/businessworldin.png
Normal file
BIN
resources/images/news/businessworldin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 444 B |
BIN
resources/images/news/dailyreckoning.png
Normal file
BIN
resources/images/news/dailyreckoning.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 996 B |
77
resources/recipes/businessworldin.recipe
Normal file
77
resources/recipes/businessworldin.recipe
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
|
'''
|
||||||
|
www.businessworld.in
|
||||||
|
'''
|
||||||
|
|
||||||
|
from calibre import strftime
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class BusinessWorldMagazine(BasicNewsRecipe):
|
||||||
|
title = 'Business World Magazine'
|
||||||
|
__author__ = 'Darko Miletic'
|
||||||
|
description = 'News from India'
|
||||||
|
publisher = 'ABP Pvt Ltd Publication'
|
||||||
|
category = 'news, politics, finances, India, Asia'
|
||||||
|
delay = 1
|
||||||
|
no_stylesheets = True
|
||||||
|
INDEX = 'http://www.businessworld.in/bw/Magazine_Current_Issue'
|
||||||
|
ROOT = 'http://www.businessworld.in'
|
||||||
|
use_embedded_content = False
|
||||||
|
encoding = 'utf-8'
|
||||||
|
language = 'en_IN'
|
||||||
|
|
||||||
|
|
||||||
|
conversion_options = {
|
||||||
|
'comment' : description
|
||||||
|
, 'tags' : category
|
||||||
|
, 'publisher' : publisher
|
||||||
|
, 'language' : language
|
||||||
|
}
|
||||||
|
|
||||||
|
def is_in_list(self,linklist,url):
|
||||||
|
for litem in linklist:
|
||||||
|
if litem == url:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def parse_index(self):
|
||||||
|
articles = []
|
||||||
|
linklist = []
|
||||||
|
soup = self.index_to_soup(self.INDEX)
|
||||||
|
|
||||||
|
for item in soup.findAll('div', attrs={'class':'nametitle'}):
|
||||||
|
description = ''
|
||||||
|
title_prefix = ''
|
||||||
|
feed_link = item.find('a')
|
||||||
|
if feed_link and feed_link.has_key('href'):
|
||||||
|
url = self.ROOT + feed_link['href']
|
||||||
|
if not self.is_in_list(linklist,url):
|
||||||
|
title = title_prefix + self.tag_to_string(feed_link)
|
||||||
|
date = strftime(self.timefmt)
|
||||||
|
articles.append({
|
||||||
|
'title' :title
|
||||||
|
,'date' :date
|
||||||
|
,'url' :url
|
||||||
|
,'description':description
|
||||||
|
})
|
||||||
|
linklist.append(url)
|
||||||
|
return [(soup.head.title.string, articles)]
|
||||||
|
|
||||||
|
|
||||||
|
keep_only_tags = [dict(name='div', attrs={'id':['register-panel','printwrapper']})]
|
||||||
|
remove_tags = [dict(name=['object','link'])]
|
||||||
|
|
||||||
|
def print_version(self, url):
|
||||||
|
return url.replace('/bw/','/bw/storyContent/')
|
||||||
|
|
||||||
|
def get_cover_url(self):
|
||||||
|
cover_url = None
|
||||||
|
soup = self.index_to_soup(self.INDEX)
|
||||||
|
cover_item = soup.find('img',attrs={'class':'toughbor'})
|
||||||
|
if cover_item:
|
||||||
|
cover_url = self.ROOT + cover_item['src']
|
||||||
|
return cover_url
|
47
resources/recipes/dailyreckoning.recipe
Normal file
47
resources/recipes/dailyreckoning.recipe
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
|
'''
|
||||||
|
dailyreckoning.com
|
||||||
|
'''
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class dailyreckoning_us(BasicNewsRecipe):
|
||||||
|
title = 'The Daily Reckoning - US edition'
|
||||||
|
__author__ = 'Darko Miletic'
|
||||||
|
description = 'Worldwide business and financial news and articles'
|
||||||
|
publisher = 'Agora Financial, LLC.'
|
||||||
|
category = 'news, business, finances, money, banking'
|
||||||
|
oldest_article = 7
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
no_stylesheets = True
|
||||||
|
use_embedded_content = False
|
||||||
|
encoding = 'utf-8'
|
||||||
|
language = 'en'
|
||||||
|
extra_css = ' #BlogTitle{font-size: x-large; font-weight: bold} #BlogDate{font-size: small} '
|
||||||
|
|
||||||
|
conversion_options = {
|
||||||
|
'comment' : description
|
||||||
|
, 'tags' : category
|
||||||
|
, 'publisher' : publisher
|
||||||
|
, 'language' : language
|
||||||
|
}
|
||||||
|
|
||||||
|
feeds = [(u'Articles', u'http://feeds.feedburner.com/dailyreckoning?format=xml')]
|
||||||
|
|
||||||
|
keep_only_tags = [dict(name='div', attrs={'id':'Outline'})]
|
||||||
|
|
||||||
|
remove_tags = [
|
||||||
|
dict(name=['object','link','base'])
|
||||||
|
,dict(name='hr', attrs={'class':'Divider'})
|
||||||
|
]
|
||||||
|
|
||||||
|
remove_tags_after = dict(name='hr', attrs={'class':'Divider'})
|
||||||
|
|
||||||
|
def get_article_url(self, article):
|
||||||
|
return article.get('feedburner_origlink', article.get('link'))
|
||||||
|
|
||||||
|
def print_version(self, url):
|
||||||
|
return url + 'print/'
|
||||||
|
|
@ -8,8 +8,7 @@ economist.com
|
|||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||||
|
|
||||||
import mechanize, string
|
import mechanize, string, urllib
|
||||||
from urllib2 import quote
|
|
||||||
|
|
||||||
class Economist(BasicNewsRecipe):
|
class Economist(BasicNewsRecipe):
|
||||||
|
|
||||||
@ -24,15 +23,26 @@ class Economist(BasicNewsRecipe):
|
|||||||
cover_url = 'http://www.economist.com/images/covers/currentcovereu_large.jpg'
|
cover_url = 'http://www.economist.com/images/covers/currentcovereu_large.jpg'
|
||||||
remove_tags = [dict(name=['script', 'noscript', 'title'])]
|
remove_tags = [dict(name=['script', 'noscript', 'title'])]
|
||||||
remove_tags_before = dict(name=lambda tag: tag.name=='title' and tag.parent.name=='body')
|
remove_tags_before = dict(name=lambda tag: tag.name=='title' and tag.parent.name=='body')
|
||||||
|
needs_subscription = True
|
||||||
|
|
||||||
def get_browser(self):
|
def get_browser(self):
|
||||||
br = BasicNewsRecipe.get_browser()
|
br = BasicNewsRecipe.get_browser()
|
||||||
if self.username is not None and self.password is not None:
|
br.open('http://www.economist.com')
|
||||||
req = mechanize.Request('http://www.economist.com/members/members.cfm?act=exec_login', headers={'Referer':'http://www.economist.com'})
|
req = mechanize.Request(
|
||||||
data = 'logging_in=Y&returnURL=http%253A%2F%2Fwww.economist.com%2Findex.cfm&email_address=username&pword=password&x=7&y=11'
|
'http://www.economist.com/members/members.cfm?act=exec_login',
|
||||||
data = data.replace('username', quote(self.username)).replace('password', quote(self.password))
|
headers = {
|
||||||
req.add_data(data)
|
'Referer':'http://www.economist.com/',
|
||||||
br.open(req).read()
|
},
|
||||||
|
data=urllib.urlencode({
|
||||||
|
'logging_in' : 'Y',
|
||||||
|
'returnURL' : '/',
|
||||||
|
'email_address': self.username,
|
||||||
|
'fakepword' : 'Password',
|
||||||
|
'pword' : self.password,
|
||||||
|
'x' : '0',
|
||||||
|
'y' : '0',
|
||||||
|
}))
|
||||||
|
br.open(req).read()
|
||||||
return br
|
return br
|
||||||
|
|
||||||
def parse_index(self):
|
def parse_index(self):
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user