From dac96c5074d1fc4eeb1908334d54e2b308355eb9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Feb 2013 16:26:47 +0530 Subject: [PATCH 1/9] Update Globe and Mail --- recipes/globe_and_mail.recipe | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/recipes/globe_and_mail.recipe b/recipes/globe_and_mail.recipe index a7c78887c5..9ee3c6bd81 100644 --- a/recipes/globe_and_mail.recipe +++ b/recipes/globe_and_mail.recipe @@ -21,6 +21,10 @@ class AdvancedUserRecipe1287083651(BasicNewsRecipe): encoding = 'utf8' publisher = 'Globe & Mail' language = 'en_CA' + use_embedded_content = False + + no_stylesheets = True + auto_cleanup = True extra_css = 'p.meta {font-size:75%}\n .redtext {color: red;}\n .byline {font-size: 70%}' feeds = [ @@ -44,12 +48,12 @@ class AdvancedUserRecipe1287083651(BasicNewsRecipe): (re.compile(r'', re.DOTALL), lambda m: ''), ] - remove_tags_before = dict(name='h1') - remove_tags = [ - dict(name='div', attrs={'id':['ShareArticles', 'topStories']}), - dict(href=lambda x: x and 'tracking=' in x), - {'class':['articleTools', 'pagination', 'Ads', 'topad', - 'breadcrumbs', 'footerNav', 'footerUtil', 'downloadlinks']}] + #remove_tags_before = dict(name='h1') + #remove_tags = [ + #dict(name='div', attrs={'id':['ShareArticles', 'topStories']}), + #dict(href=lambda x: x and 'tracking=' in x), + #{'class':['articleTools', 'pagination', 'Ads', 'topad', + #'breadcrumbs', 'footerNav', 'footerUtil', 'downloadlinks']}] def populate_article_metadata(self, article, soup, first): if first and hasattr(self, 'add_toc_thumbnail'): From 78be0818e7cec299bc444c81afedeb7a7ad74fb4 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Feb 2013 19:14:07 +0530 Subject: [PATCH 2/9] Libertad Digital by Darko Miletic. Fixes #1112497 (New recipe for Libertad Digital) --- recipes/icons/libertad_digital.png | Bin 0 -> 1093 bytes recipes/libertad_digital.recipe | 65 +++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 recipes/icons/libertad_digital.png create mode 100644 recipes/libertad_digital.recipe diff --git a/recipes/icons/libertad_digital.png b/recipes/icons/libertad_digital.png new file mode 100644 index 0000000000000000000000000000000000000000..83ed5a6dda94fc5176619f10fe53b6928a335466 GIT binary patch literal 1093 zcmeHE>q}E{0R3&VQc)a{A2P`zKV)c>8HqAqscDw4EG_d1Qka2CZ1-BsS&>Y_M?yN^ zGl_gMml-x^qK52ocTG~9Iya}Av#~ABHmBSDHUEn~bl{xx^*q?giPzj+y<7nR?(uQa zsSc+e(3#@UvjHBr0HA>68)-2lL>$(%)Q0Jqf(;TPP3c@TT5Kglt40d}?KYFeYO?I* z^r_uhGt_b!pkn|P0aQ#apP@A`*$K!JtX-&^1E^G}*eT|#BbpYn`c*7}W_)=YpfZ+V z1E6?rpQ?6B&l=OHjMfg!_{(A^2pe$#xMH$$v7aOq_h8AAxJzWZh)kE*AS~strlMEFab3T5~C1J*zR(I17Lw0t|^A+Qt{R00Xl_0x)EtOxz(cfHLe- zoxDwIaC9IsWK5wpuSZEh$Q0@-M%N>o<)kvKVpJR1yjb#4Q!%O|Gp2p2W=eTVrNLY- zRQpuT=JYBd+;5lakFszG?d?*7$?V7lO=iMm-JeiwZ~q~vObj3*fJhX^U4UQ|h8Q5S z2+k6<;yXZa3PZ}9Gf^Co{^K8BfL_q70e}SJqa)Lh7I&G;8FJ(?psJKdWu((K(&F+J z@iI(XJtz(+7;bo1m$D0=eN|DOG-gk|O|Pn%_pj&hYP|}D=gHNgp;hnhY$|8gEydO9 zbo<2T>yw%CR__LO;D;`^bBdQ}!WGU|)Z>S~?=Lf77+x>iLo$CH&zmdK0q)>Ub<0|s zwh&gn8XRB6C=FhoYG6}63W8uTk{77+h`XD?57Q+W*iR)+^R(jo)1F(b zN1k8SopCXLzcXr2pR@^%92y(p3H(Cx6LEjEaqSd8^$q^%BK@9UY|&xvL@ZC=+Fc*i n&&OL_7Gv*Bws!fN!UuZ^FmN(7>+~> Date: Fri, 1 Feb 2013 21:36:11 +0530 Subject: [PATCH 3/9] Update Le Monde (subscription version) --- recipes/le_monde_sub.recipe | 84 ++++++++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 25 deletions(-) diff --git a/recipes/le_monde_sub.recipe b/recipes/le_monde_sub.recipe index 8da4a97627..7767e44fc3 100644 --- a/recipes/le_monde_sub.recipe +++ b/recipes/le_monde_sub.recipe @@ -1,15 +1,16 @@ #!/usr/bin/env python __license__ = 'GPL v3' -__copyright__ = '2012, Rémi Vanicat ' +__copyright__ = '2012, 2013, Rémi Vanicat ' ''' Lemonde.fr: Version abonnée ''' import os, zipfile, re, time +from urllib2 import HTTPError +from calibre.constants import preferred_encoding -from calibre import strftime from calibre.web.feeds.news import BasicNewsRecipe from calibre.ebooks.BeautifulSoup import BeautifulSoup from calibre.ptempfile import PersistentTemporaryFile @@ -20,34 +21,44 @@ class LeMondeAbonne(BasicNewsRecipe): __author__ = u'Rémi Vanicat' description = u'Actualités' category = u'Actualités, France, Monde' + publisher = 'Le Monde' language = 'fr' needs_subscription = True + no_stylesheets = True + smarten_punctuation = True + remove_attributes = [ 'border', 'cellspacing', 'display', 'align', 'cellpadding', 'colspan', 'valign', 'vscape', 'hspace', 'alt', 'width', 'height'] + extra_css = ''' li{margin:6pt 0} + ul{margin:0} - no_stylesheets = True + div.photo img{max-width:100%; border:0px transparent solid;} + div.photo{font-family:inherit; color:#333; text-align:center;} + div.photo p{text-align:justify;font-size:.9em; line-height:.9em;} - extra_css = u''' - h1{font-size:130%;} - .ariane{font-size:xx-small;} - .source{font-size:xx-small;} - .href{font-size:xx-small;} - .LM_caption{color:#666666; font-size:x-small;} - .main-article-info{font-family:Arial,Helvetica,sans-serif;} - #full-contents{font-size:small; font-family:Arial,Helvetica,sans-serif;font-weight:normal;} - #match-stats-summary{font-size:small; font-family:Arial,Helvetica,sans-serif;font-weight:normal;} - ''' + @page{margin:10pt} + .ar-txt {color:#000; text-align:justify;} + h1{text-align:left; font-size:1.25em;} + + .auteur{text-align:right; font-weight:bold} + .feed{text-align:right; font-weight:bold} + .po-ti2{font-weight:bold} + .fen-tt{font-weight:bold;font-size:1.1em} + ''' zipurl_format = 'http://medias.lemonde.fr/abonnes/editionelectronique/%Y%m%d/html/%y%m%d.zip' coverurl_format = '/img/%y%m%d01.jpg' path_format = "%y%m%d" login_url = 'http://www.lemonde.fr/web/journal_electronique/identification/1,56-0,45-0,0.html' - keep_only_tags = [ dict(name="div", attrs={ 'class': 'po-prti' }), dict(name=['h1']), dict(name='div', attrs={ 'class': 'photo' }), dict(name='div', attrs={ 'class': 'po-ti2' }), dict(name='div', attrs={ 'class': 'ar-txt' }), dict(name='div', attrs={ 'class': 'po_rtcol' }) ] + keep_only_tags = [dict(name=['h1']), dict(name='div', attrs={ 'class': 'photo' }), dict(name='div', attrs={ 'class': 'po-ti2' }), dict(name='div', attrs={ 'class': 'ar-txt' }), dict(name='div', attrs={ 'class': 'po_rtcol' }) ] + + + remove_tags = [ dict(name='div', attrs={ 'class': 'po-ti' }),dict(name='div', attrs={ 'class': 'po-copy' })] article_id_pattern = re.compile("[0-9]+\\.html") article_url_format = 'http://www.lemonde.fr/journalelectronique/donnees/protege/%Y%m%d/html/' def get_browser(self): - br = BasicNewsRecipe.get_browser(self) + br = BasicNewsRecipe.get_browser() if self.username is not None and self.password is not None: br.open(self.login_url) br.select_form(nr=0) @@ -67,12 +78,16 @@ class LeMondeAbonne(BasicNewsRecipe): second = time.time() second += self.decalage - ltime = self.ltime = time.gmtime(second) - url = time.strftime(self.zipurl_format, ltime) - self.timefmt=strftime(" %A %d %B %Y", ltime) - - response = browser.open(url) + for i in range(7): + self.ltime = time.gmtime(second) + self.timefmt=time.strftime(" %A %d %B %Y",self.ltime).decode(preferred_encoding) + url = time.strftime(self.zipurl_format,self.ltime) + try: + response = browser.open(url) + continue + except HTTPError: + second -= 24*60*60 tmp = PersistentTemporaryFile(suffix='.zip') self.report_progress(0.1,_('downloading zip file')) @@ -85,7 +100,7 @@ class LeMondeAbonne(BasicNewsRecipe): zfile.extractall(self.output_dir) zfile.close() - path = os.path.join(self.output_dir, time.strftime(self.path_format, ltime), "data") + path = os.path.join(self.output_dir, time.strftime(self.path_format, self.ltime), "data") self.articles_path = path @@ -95,13 +110,33 @@ class LeMondeAbonne(BasicNewsRecipe): flux = [] - article_url = time.strftime(self.article_url_format, ltime) + article_url = time.strftime(self.article_url_format, self.ltime) for i in range(nb_index_files): filename = os.path.join(path, "selection_%d.html" % (i + 1)) tmp = open(filename,'r') - soup=BeautifulSoup(tmp) + soup=BeautifulSoup(tmp,convertEntities=BeautifulSoup.HTML_ENTITIES) title=soup.find('span').contents[0] + if title=="Une": + title="À la une" + if title=="Evenement": + title="L'événement" + if title=="Planete": + title="Planète" + if title=="Economie - Entreprises": + title="Économie" + if title=="L'Oeil du Monde": + title="L'œil du Monde" + if title=="Enquete": + title="Enquête" + if title=="Editorial - Analyses": + title="Analyses" + if title=="Le Monde Economie": + title="Économie" + if title=="Le Monde Culture et idées": + title="Idées" + if title=="Le Monde Géo et politique": + title="Géopolitique" tmp.close() filename = os.path.join(path, "frame_gauche_%d.html" % (i + 1)) @@ -114,7 +149,7 @@ class LeMondeAbonne(BasicNewsRecipe): article = { 'title': link.contents[0], 'url': article_url + article_id, - 'descripion': '', + 'description': '', 'content': '' } articles.append(article) @@ -129,4 +164,3 @@ class LeMondeAbonne(BasicNewsRecipe): # Local Variables: # mode: python # End: - From f84ab10fec67968be7e6ee85043b21f945b6fce9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Feb 2013 21:37:14 +0530 Subject: [PATCH 4/9] Update The Toronto Star. Fixes #1112611 (Updated recipe for toronto star) --- recipes/thestar.recipe | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/recipes/thestar.recipe b/recipes/thestar.recipe index f667b86472..59c3b43c6b 100644 --- a/recipes/thestar.recipe +++ b/recipes/thestar.recipe @@ -1,7 +1,5 @@ -#!/usr/bin/env python - __license__ = 'GPL v3' -__copyright__ = '2009, Darko Miletic ' +__copyright__ = '2009-2013, Darko Miletic ' ''' www.thestar.com ''' @@ -11,18 +9,17 @@ from calibre.web.feeds.news import BasicNewsRecipe class TheTorontoStar(BasicNewsRecipe): title = 'The Toronto Star' __author__ = 'Darko Miletic' - description = "Canada's largest daily newspaper" + description = "Thestar.com is Canada's largest online news site. Stay current with our sports, business entertainment news and more from the Toronto Star and thestar.com" oldest_article = 2 language = 'en_CA' max_articles_per_feed = 100 no_stylesheets = True - #auto_cleanup = True - #auto_cleanup_keep = '//div[@class="topsContent topsContentActive"]' use_embedded_content = False delay = 2 publisher = 'The Toronto Star' category = "Toronto Star,Canada's largest daily newspaper,breaking news,classifieds,careers,GTA,Toronto Maple Leafs,sports,Toronto,news,editorial,The Star,Ontario,information,columnists,business,entertainment,births,deaths,automotive,rentals,weather,archives,Torstar,technology,Joseph Atkinson" encoding = 'utf-8' + masthead_url = 'http://www.thestar.com/etc/designs/thestar/images/general/logoLrg.png' conversion_options = { 'comments' : description @@ -30,23 +27,18 @@ class TheTorontoStar(BasicNewsRecipe): ,'publisher' : publisher } - #keep_only_tags = [dict(name='div', attrs={'class':'ts-article'})] - #remove_tags_before = dict(name='div',attrs={'id':'ts-article_header'}) + remove_tags_before = dict(name='div',attrs={'class':'article-headline'}) feeds = [ - (u'News' , u'http://www.thestar.com/rss/?categories=293' ) - ,(u'Opinion' , u'http://www.thestar.com/rss/?categories=303' ) - ,(u'Business' , u'http://www.thestar.com/rss/?categories=294' ) - ,(u'Sports' , u'http://www.thestar.com/rss/?categories=295' ) - ,(u'Entertainment', u'http://www.toronto.com/rss?categories=6298' ) - ,(u'Living' , u'http://www.thestar.com/rss/?categories=297' ) - ,(u'Travel' , u'http://www.thestar.com/rss/list/1042246?' ) - ,(u'Science' , u'http://www.thestar.com/rss?categories=6481') + (u'News' , u'http://www.thestar.com/feeds.articles.news.rss' ) + ,(u'Opinion' , u'http://www.thestar.com/feeds.articles.opinion.rss' ) + ,(u'Business' , u'http://www.thestar.com/feeds.articles.business.rss' ) + ,(u'Sports' , u'http://www.thestar.com/feeds.articles.sports.rss' ) + ,(u'Entertainment', u'http://www.thestar.com/feeds.articles.entertainment.rss' ) + ,(u'Living' , u'http://www.thestar.com/feeds.articles.life.rss' ) + ,(u'Travel' , u'http://www.thestar.com/feeds.articles.life.travel.rss' ) + ,(u'Technology' , u'http://www.thestar.com/feeds.articles.life.technology.rss') ] def print_version(self, url): - artl = url.rpartition('--')[0] - artid = artl.rpartition('/')[2] - return 'http://www.thestar.com/printarticle/' + artid - - + return url.replace('.html', '.print.html') From fdf294731477135399f5c1676378ce2b7393563a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Feb 2013 22:07:54 +0530 Subject: [PATCH 5/9] Output profile for the Nook Tablet. Fixes #1105478 (Can a compatibility option be added for the Nook HD+?) --- src/calibre/customize/profiles.py | 9 ++++++++- src/calibre/gui2/wizard/__init__.py | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/calibre/customize/profiles.py b/src/calibre/customize/profiles.py index 7eba099bd2..d544496f19 100644 --- a/src/calibre/customize/profiles.py +++ b/src/calibre/customize/profiles.py @@ -452,6 +452,13 @@ class SamsungGalaxy(TabletOutput): 'a resolution of 600x1280') screen_size = comic_screen_size = (600, 1280) +class NookHD(TabletOutput): + name = 'Nook HD+' + short_name = 'nook_hd_plus' + description = _('Intended for the Nook HD+ and similar tablet devices with ' + 'a resolution of 1080x1920') + screen_size = comic_screen_size = (1080, 1920) + class SonyReaderOutput(OutputProfile): name = 'Sony Reader' @@ -786,7 +793,7 @@ output_profiles = [OutputProfile, SonyReaderOutput, SonyReader300Output, SonyReader900Output, MSReaderOutput, MobipocketOutput, HanlinV3Output, HanlinV5Output, CybookG3Output, CybookOpusOutput, KindleOutput, iPadOutput, iPad3Output, KoboReaderOutput, TabletOutput, SamsungGalaxy, - SonyReaderLandscapeOutput, KindleDXOutput, IlliadOutput, + SonyReaderLandscapeOutput, KindleDXOutput, IlliadOutput, NookHD, IRexDR1000Output, IRexDR800Output, JetBook5Output, NookOutput, BambookOutput, NookColorOutput, PocketBook900Output, PocketBookPro912Output, GenericEink, GenericEinkLarge, KindleFireOutput, KindlePaperWhiteOutput] diff --git a/src/calibre/gui2/wizard/__init__.py b/src/calibre/gui2/wizard/__init__.py index 1cdcb85d4c..8016dd7dcd 100644 --- a/src/calibre/gui2/wizard/__init__.py +++ b/src/calibre/gui2/wizard/__init__.py @@ -198,6 +198,7 @@ class NookColor(Nook): class NookTablet(NookColor): id = 'nook_tablet' name = 'Nook Tablet/HD' + output_profile = 'nook_hd_plus' class CybookG3(Device): From 276b1699f4be1eb5b5739e4c09094ee9f2d70382 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Feb 2013 22:09:34 +0530 Subject: [PATCH 6/9] Update Japan Times. Fixes #1112656 (Updated recipe for Japan Times) --- recipes/japan_times.recipe | 68 ++++++++++++++------------------------ 1 file changed, 25 insertions(+), 43 deletions(-) diff --git a/recipes/japan_times.recipe b/recipes/japan_times.recipe index f5b90f2c05..80a68c5216 100644 --- a/recipes/japan_times.recipe +++ b/recipes/japan_times.recipe @@ -1,5 +1,5 @@ __license__ = 'GPL v3' -__copyright__ = '2008-2011, Darko Miletic ' +__copyright__ = '2008-2013, Darko Miletic ' ''' japantimes.co.jp ''' @@ -13,59 +13,41 @@ class JapanTimes(BasicNewsRecipe): language = 'en_JP' category = 'news, politics, japan' publisher = 'The Japan Times' - oldest_article = 5 + oldest_article = 2 max_articles_per_feed = 150 no_stylesheets = True use_embedded_content = False encoding = 'utf8' publication_type = 'newspaper' - masthead_url = 'http://search.japantimes.co.jp/images/header_title.gif' + masthead_url = 'http://www.japantimes.co.jp/wp-content/themes/jt_theme/library/img/logo-japan-times.png' extra_css = 'body{font-family: Geneva,Arial,Helvetica,sans-serif}' conversion_options = { - 'comment' : description - , 'tags' : category - , 'publisher' : publisher - , 'language' : language - , 'linearize_tables' : True + 'comment' : description + , 'tags' : category + , 'publisher' : publisher + , 'language' : language } - - keep_only_tags = [dict(name='div', attrs={'id':'printresult'})] - remove_tags = [ - dict(name=['iframe','meta','link','embed','object','base']) - ,dict(attrs={'id':'searchfooter'}) - ] - feeds = [(u'The Japan Times', u'http://feeds.feedburner.com/japantimes')] - remove_attributes = ['border'] + remove_tags_after = dict(name='div', attrs={'class':'entry'}) + keep_only_tags = [dict(name='div', attrs={'class':'padding_block'})] + remove_tags = [ + dict(name=['iframe','embed','object','base']) + ,dict(attrs={'class':['meta_extras','related_articles']}) + ,dict(attrs={'id':'content_footer_menu'}) + ] + feeds = [ + (u'News' , u'http://www.japantimes.co.jp/news/feed/' ) + ,(u'Opinion' , u'http://www.japantimes.co.jp/opinion/feed/' ) + ,(u'Life' , u'http://www.japantimes.co.jp/opinion/feed/' ) + ,(u'Community', u'http://www.japantimes.co.jp/community/feed/') + ,(u'Culture' , u'http://www.japantimes.co.jp/culture/feed/' ) + ,(u'Sports' , u'http://www.japantimes.co.jp/sports/feed/' ) + ] def get_article_url(self, article): rurl = BasicNewsRecipe.get_article_url(self, article) return rurl.partition('?')[0] - - def print_version(self, url): - if '/rss/' in url: - return url.replace('.jp/rss/','.jp/print/') - if '/text/' in url: - return url.replace('.jp/text/','.jp/print/') - return url - - def preprocess_html(self, soup): - for item in soup.findAll(style=True): - del item['style'] - for item in soup.findAll('img'): - if not item.has_key('alt'): - item['alt'] = 'image' - for item in soup.findAll('photo'): - item.name = 'div' - for item in soup.head.findAll('paragraph'): - item.extract() - for item in soup.findAll('wwfilename'): - item.extract() - for item in soup.findAll('jtcategory'): - item.extract() - for item in soup.findAll('nomooter'): - item.extract() - for item in soup.body.findAll('paragraph'): - item.name = 'p' - return soup + + def preprocess_raw_html(self, raw, url): + return ''+raw[raw.find(''):] From 6559d382ade80150be2885e95ebd5e231b39d4bf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 2 Feb 2013 09:56:58 +0530 Subject: [PATCH 7/9] ... --- manual/faq.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual/faq.rst b/manual/faq.rst index 572d18b770..1f64fb54c7 100644 --- a/manual/faq.rst +++ b/manual/faq.rst @@ -663,7 +663,7 @@ Post any output you see in a help message on the `Forum Date: Sat, 2 Feb 2013 12:38:43 +0530 Subject: [PATCH 8/9] Tweak Book: When rebuilding azw3 files handle tags that have name but not id attribute, these are apparently produced by kindlegen. Fixes #1112934 (links are borken in azw3 (KF8) when tweaking book) --- src/calibre/ebooks/mobi/writer8/main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/calibre/ebooks/mobi/writer8/main.py b/src/calibre/ebooks/mobi/writer8/main.py index b1479ee7c3..47a27dd06c 100644 --- a/src/calibre/ebooks/mobi/writer8/main.py +++ b/src/calibre/ebooks/mobi/writer8/main.py @@ -241,6 +241,11 @@ class KF8Writer(object): j = 0 for tag in root.iterdescendants(etree.Element): id_ = tag.attrib.get('id', None) + if id_ is None: + # Can happen during tweaking + id_ = tag.attrib.get('name', None) + if id_ is not None: + tag.attrib['id'] = id_ if id_ is not None or barename(tag.tag).lower() in aid_able_tags: aid = aidbase + j tag.attrib['aid'] = to_base(aid, base=32) From cbe0e8bd174a2312eae1f035382a974c29e44e1f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 2 Feb 2013 12:57:40 +0530 Subject: [PATCH 9/9] ... --- recipes/le_monde_sub.recipe | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/le_monde_sub.recipe b/recipes/le_monde_sub.recipe index 7767e44fc3..56156166dc 100644 --- a/recipes/le_monde_sub.recipe +++ b/recipes/le_monde_sub.recipe @@ -58,7 +58,7 @@ class LeMondeAbonne(BasicNewsRecipe): article_url_format = 'http://www.lemonde.fr/journalelectronique/donnees/protege/%Y%m%d/html/' def get_browser(self): - br = BasicNewsRecipe.get_browser() + br = BasicNewsRecipe.get_browser(self) if self.username is not None and self.password is not None: br.open(self.login_url) br.select_form(nr=0)