update NIN Online. Fixes #5547 (Updated recipe for NIN online)

This commit is contained in:
Kovid Goyal 2010-05-16 14:42:16 -06:00
parent d88067518e
commit e02d86fe90

View File

@ -5,7 +5,7 @@ __copyright__ = '2008-2010, Darko Miletic <darko.miletic at gmail.com>'
www.nin.co.rs www.nin.co.rs
''' '''
import re, urllib import re
from calibre import strftime from calibre import strftime
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
@ -16,13 +16,13 @@ class Nin(BasicNewsRecipe):
publisher = 'NIN d.o.o.' publisher = 'NIN d.o.o.'
category = 'news, politics, Serbia' category = 'news, politics, Serbia'
no_stylesheets = True no_stylesheets = True
delay = 1
oldest_article = 15 oldest_article = 15
encoding = 'utf-8' encoding = 'utf-8'
needs_subscription = True needs_subscription = True
remove_empty_feeds = True remove_empty_feeds = True
PREFIX = 'http://www.nin.co.rs' PREFIX = 'http://www.nin.co.rs'
INDEX = PREFIX + '/?change_lang=ls' INDEX = PREFIX + '/?change_lang=ls'
LOGIN = PREFIX + '/?logout=true'
use_embedded_content = False use_embedded_content = False
language = 'sr' language = 'sr'
publication_type = 'magazine' publication_type = 'magazine'
@ -41,14 +41,12 @@ class Nin(BasicNewsRecipe):
def get_browser(self): def get_browser(self):
br = BasicNewsRecipe.get_browser() br = BasicNewsRecipe.get_browser()
br.open(self.INDEX)
if self.username is not None and self.password is not None: if self.username is not None and self.password is not None:
data = urllib.urlencode({ 'login_name':self.username br.open(self.INDEX)
,'login_password':self.password br.select_form(name='form1')
,'imageField.x':'32' br['login_name' ] = self.username
,'imageField.y':'15' br['login_password'] = self.password
}) br.submit()
br.open(self.LOGIN,data)
return br return br
keep_only_tags =[dict(name='td', attrs={'width':'520'})] keep_only_tags =[dict(name='td', attrs={'width':'520'})]