Update Frontline

This commit is contained in:
Kovid Goyal 2014-04-05 09:45:07 +05:30
parent 6c77678f57
commit d368f0f745

View File

@ -1,4 +1,3 @@
__license__ = 'GPL v3'
__copyright__ = '2011, Darko Miletic <darko.miletic at gmail.com>'
'''
@ -36,7 +35,7 @@ class Frontlineonnet(BasicNewsRecipe):
}
preprocess_regexps = [
(re.compile(r'.*?<base', re.DOTALL|re.IGNORECASE),lambda match: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html dir="ltr" xml:lang="en-IN"><head><title>title</title><base')
(re.compile(r'.*?<base', re.DOTALL|re.IGNORECASE),lambda match: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html dir="ltr" xml:lang="en-IN"><head><title>title</title><base') # noqa
,(re.compile(r'<base .*?>', re.DOTALL|re.IGNORECASE),lambda match: '</head><body>')
,(re.compile(r'<byline>', re.DOTALL|re.IGNORECASE),lambda match: '<div class="byline">')
,(re.compile(r'</byline>', re.DOTALL|re.IGNORECASE),lambda match: '</div>')
@ -49,6 +48,17 @@ class Frontlineonnet(BasicNewsRecipe):
]
remove_attributes=['size','noshade','border']
use_javascript_to_login = True
needs_subscription = True
def javascript_login(self, browser, username, password):
browser.visit('http://www.frontline.in/profile/login.do')
browser.wait_for_element('form#loginForm', timeout=180)
form = browser.select_form('#loginForm') # Select the first form on the page
form['userName'] = username
form['password'] = password
browser.submit(timeout=120)
def parse_index(self):
articles = []
current_section = None