The West Australian by Darko Miletic

This commit is contained in:
Kovid Goyal 2010-04-23 09:24:54 -06:00
parent a4ff200488
commit e04d61fe17
3 changed files with 66 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

View File

@ -0,0 +1,63 @@
__license__ = 'GPL v3'
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
'''
thewest.com.au
'''
import re
from calibre.web.feeds.news import BasicNewsRecipe
class TheWest(BasicNewsRecipe):
title = 'The West Australian'
__author__ = 'Darko Miletic'
description = 'News from Australia'
publisher = 'thewest.com.au'
category = 'news, politics, Australia'
oldest_article = 2
max_articles_per_feed = 200
no_stylesheets = True
encoding = 'utf8'
use_embedded_content = False
language = 'en_AU'
remove_empty_feeds = True
publication_type = 'newspaper'
masthead_url = 'http://l.yimg.com/ao/i/mp/properties/news/02/wan/img/wan-logo-h49.png'
extra_css = ' .article{font-family: Arial,Helvetica,sans-serif } .image{font-size: x-small} '
preprocess_regexps = [
(re.compile(r'</title>.*?</head>', re.DOTALL|re.IGNORECASE),lambda match: '</title></head>')
]
conversion_options = {
'comment' : description
, 'tags' : category
, 'publisher' : publisher
, 'language' : language
}
remove_tags = [
dict(attrs={'class':['tools','lhs']})
,dict(attrs={'id' :'tools-bottom'})
,dict(attrs={'href' :'http://twitter.com/thewest_com_au'})
]
keep_only_tags = [dict(attrs={'class':'mod article'})]
remove_attributes = ['width','height']
feeds = [
(u'WA News' , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/wa.xml' )
,(u'National' , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/national.xml' )
,(u'World' , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/world.xml' )
,(u'Offbeat' , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/offbeat.xml' )
,(u'Business' , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/business.xml' )
,(u'Sport' , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/sport.xml' )
,(u'Entertainment' , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/entertainment.xml' )
,(u'Travel' , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/travel.xml' )
,(u'Life+Style' , u'http://d.yimg.com/au.rss.news.yahoo.com/thewest/lifestyle.xml' )
]
def get_article_url(self, article):
return article.get('guid', None)
def preprocess_html(self, soup):
return self.adeify_images(soup)

View File

@ -14,7 +14,7 @@
<string>Schedule news download</string> <string>Schedule news download</string>
</property> </property>
<property name="windowIcon"> <property name="windowIcon">
<iconset resource="../../../../resources/images.qrc"> <iconset>
<normaloff>:/images/scheduler.svg</normaloff>:/images/scheduler.svg</iconset> <normaloff>:/images/scheduler.svg</normaloff>:/images/scheduler.svg</iconset>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
@ -79,7 +79,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>375</width> <width>375</width>
<height>500</height> <height>502</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_5"> <layout class="QVBoxLayout" name="verticalLayout_5">
@ -371,7 +371,7 @@
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="standardButtons"> <property name="standardButtons">
<set>QDialogButtonBox::Ok</set> <set>QDialogButtonBox::Save</set>
</property> </property>
</widget> </widget>
</item> </item>