Quote:
Originally Posted by Hypernova
Now for physicstoday.org. Pretty much the same deal. Needed login for some articles. This is essentually the entire magazine, so I think it'll be quite useful. Could you help me with the login again?
Code:
import re
class AdvancedUserRecipe1234950056(BasicNewsRecipe):
title = u'Physicstoday'
oldest_article = 30
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
remove_javascript = True
remove_tags_before = dict(name='h1')
remove_tags_after = [dict(name='div', attrs={'id':'footer'})]
feeds = [(u'All', u'http://www.physicstoday.org/feed.xml')]
|
Since I believe in teaching in a man to fish, here's the login code from physics world
Code:
needs_subscription = True
def get_browser(self):
br = BasicNewsRecipe.get_browser(self)
if self.username is not None and self.password is not None:
br.open('http://physicsworld.com/cws/sign-in')
br.select_form(nr=1)
br['username'] = self.username
br['password'] = self.password
br.submit()
return br