mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
new recipes for inquirer and uncrate by Darko Miletic
This commit is contained in:
parent
b041e4a887
commit
335f2147e5
BIN
src/calibre/gui2/images/news/inquirer_net.png
Normal file
BIN
src/calibre/gui2/images/news/inquirer_net.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 837 B |
BIN
src/calibre/gui2/images/news/uncrate.png
Normal file
BIN
src/calibre/gui2/images/news/uncrate.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 269 B |
@ -50,7 +50,7 @@ recipe_modules = ['recipe_' + r for r in (
|
||||
'marca', 'kellog_faculty', 'kellog_insight',
|
||||
'theeconomictimes_india', '7dias', 'buenosaireseconomico',
|
||||
'diagonales', 'miradasalsur', 'newsweek_argentina', 'veintitres',
|
||||
'gva_be', 'hln', 'tijd', 'degentenaar',
|
||||
'gva_be', 'hln', 'tijd', 'degentenaar', 'inquirer_net', 'uncrate',
|
||||
)]
|
||||
|
||||
import re, imp, inspect, time, os
|
||||
|
61
src/calibre/web/feeds/recipes/recipe_inquirer_net.py
Normal file
61
src/calibre/web/feeds/recipes/recipe_inquirer_net.py
Normal file
@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||
'''
|
||||
www.inquirer.net
|
||||
'''
|
||||
|
||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||
from calibre.ebooks.BeautifulSoup import Tag
|
||||
|
||||
class InquirerNet(BasicNewsRecipe):
|
||||
title = 'Inquirer.net'
|
||||
__author__ = 'Darko Miletic'
|
||||
description = 'News from Philipines'
|
||||
oldest_article = 2
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
use_embedded_content = False
|
||||
encoding = 'cp1252'
|
||||
publisher = 'inquirer.net'
|
||||
category = 'news, politics, philipines'
|
||||
lang = 'en'
|
||||
language = _('English')
|
||||
extra_css = ' .fontheadline{font-size: x-large} .fontsubheadline{font-size: large} .fontkick{font-size: medium}'
|
||||
|
||||
html2lrf_options = [
|
||||
'--comment', description
|
||||
, '--category', category
|
||||
, '--publisher', publisher
|
||||
, '--ignore-tables'
|
||||
]
|
||||
|
||||
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\nlinearize_tables=True'
|
||||
|
||||
remove_tags = [dict(name=['object','link','script','iframe','form'])]
|
||||
|
||||
feeds = [
|
||||
(u'Breaking news', u'http://services.inquirer.net/rss/breakingnews.xml' )
|
||||
,(u'Top stories' , u'http://services.inquirer.net/rss/topstories.xml' )
|
||||
,(u'Sports' , u'http://services.inquirer.net/rss/brk_breakingnews.xml' )
|
||||
,(u'InfoTech' , u'http://services.inquirer.net/rss/infotech_tech.xml' )
|
||||
,(u'InfoTech' , u'http://services.inquirer.net/rss/infotech_tech.xml' )
|
||||
,(u'Business' , u'http://services.inquirer.net/rss/inq7money_breaking_news.xml' )
|
||||
,(u'Editorial' , u'http://services.inquirer.net/rss/opinion_editorial.xml' )
|
||||
,(u'Global Nation', u'http://services.inquirer.net/rss/globalnation_breakingnews.xml')
|
||||
]
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
|
||||
mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
|
||||
soup.head.insert(0,mlang)
|
||||
soup.head.insert(1,mcharset)
|
||||
for item in soup.findAll(style=True):
|
||||
del item['style']
|
||||
return soup
|
||||
|
||||
def print_version(self, url):
|
||||
rest, sep, art = url.rpartition('/view/')
|
||||
art_id, sp, rrest = art.partition('/')
|
||||
return 'http://services.inquirer.net/print/print.php?article_id=' + art_id
|
47
src/calibre/web/feeds/recipes/recipe_uncrate.py
Normal file
47
src/calibre/web/feeds/recipes/recipe_uncrate.py
Normal file
@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||
'''
|
||||
www.uncrate.com
|
||||
'''
|
||||
|
||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag
|
||||
|
||||
class Uncrate(BasicNewsRecipe):
|
||||
title = 'Uncrate'
|
||||
__author__ = 'Darko Miletic'
|
||||
description = 'Uncrate is a web magazine for guys who love stuff. Our team digs up the best gadgets, clothes, cars, DVDs and more. New items are posted daily. Enjoy responsively.'
|
||||
oldest_article = 7
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
use_embedded_content = False
|
||||
encoding = 'utf-8'
|
||||
publisher = 'Zombie corp.'
|
||||
category = 'news, gadgets, clothes, cars, DVDs'
|
||||
lang = 'en-US'
|
||||
language = _('English')
|
||||
|
||||
html2lrf_options = [
|
||||
'--comment', description
|
||||
, '--category', category
|
||||
, '--publisher', publisher
|
||||
]
|
||||
|
||||
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
|
||||
|
||||
keep_only_tags = [dict(name='div', attrs={'class':'lefttext'})]
|
||||
remove_tags_after = dict(name='div', attrs={'class':'serif'})
|
||||
remove_tags = [dict(name=['object','link','script','iframe','form'])]
|
||||
|
||||
feeds = [(u'Articles', u'http://feeds.feedburner.com/uncrate')]
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
|
||||
mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
|
||||
soup.head.insert(0,mlang)
|
||||
soup.head.insert(1,mcharset)
|
||||
for item in soup.findAll(style=True):
|
||||
del item['style']
|
||||
return self.adeify_images(soup)
|
Loading…
x
Reference in New Issue
Block a user