Thanks for your help Starson17 !
Here is the recipes code:
Code:
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
'''
Lloyds
'''
from calibre.web.feeds.news import BasicNewsRecipe
class Lloyd(BasicNewsRecipe):
title = u'Lloyd'
__author__ = 'Darko Miletic and Sujata Raman'
description = 'Shipping News'
oldest_article = 2
language = 'en'
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
needs_subscription = True
simultaneous_downloads= 1
delay = 1
LOGIN = 'http://www.lloydslist.com/ll/login.htm'
def get_browser(self):
br = BasicNewsRecipe.get_browser()
if self.username is not None and self.password is not None:
br.open(self.LOGIN)
br.select_form(nr=0)
br['username'] = self.username
br['password'] = self.password
br.submit()
return br
feeds = [(u'Containers', u'http://www.lloydslist.com/ll/sector/containers/?service=rss')
, (u'Dry Cargo', u'http://www.lloydslist.com/ll/sector/dry-cargo/?service=rss')
, (u'Finance', u'http://www.lloydslist.com/ll/sector/finance/?service=rss')
, (u'Insurance', u'http://www.lloydslist.com/ll/sector/insurance/?service=rss')
, (u'Port and Logistic', u'http://www.lloydslist.com/ll/sector/ports-and-logistics/?service=rss')
, (u'Regulation', u'http://www.lloydslist.com/ll/sector/regulation/?service=rss')
, (u'Ship Operation', u'http://www.lloydslist.com/ll/sector/ship-operations/?service=rss')
]
def preprocess_html(self, soup):
content_type = soup.find('meta', {'http-equiv':'Content-Type'})
if content_type:
content_type['content'] = 'text/html; charset=utf-8'
return soup
As you said I changed the way of looking for the form and now I get a new error (so we progress thanks to you !!!)
Quote:
ClientForm.ControlNotFoundError: no control matching name 'username'
|