Update NSFW. Fixes #1178221 (Updated recipe for Not Safe For Work)

This commit is contained in:
Kovid Goyal 2013-05-09 18:01:05 +05:30
parent bcb19457e2
commit 4c58c6b0ef

View File

@ -1,6 +1,5 @@
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2012, Darko Miletic <darko.miletic at gmail.com>' __copyright__ = '2012-2013, Darko Miletic <darko.miletic at gmail.com>'
''' '''
www.nsfwcorp.com www.nsfwcorp.com
''' '''
@ -20,8 +19,8 @@ class NotSafeForWork(BasicNewsRecipe):
needs_subscription = True needs_subscription = True
auto_cleanup = False auto_cleanup = False
INDEX = 'https://www.nsfwcorp.com' INDEX = 'https://www.nsfwcorp.com'
LOGIN = INDEX + '/login/target/' LOGIN = INDEX + '/account/login/?next=%2F'
SETTINGS = INDEX + '/settings/' SETTINGS = INDEX + '/account/settings/'
use_embedded_content = True use_embedded_content = True
language = 'en' language = 'en'
publication_type = 'magazine' publication_type = 'magazine'
@ -48,19 +47,20 @@ class NotSafeForWork(BasicNewsRecipe):
def get_browser(self): def get_browser(self):
br = BasicNewsRecipe.get_browser(self) br = BasicNewsRecipe.get_browser(self)
br.open(self.LOGIN) 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({ 'email':self.username br.open(self.LOGIN)
,'password':self.password br.select_form(nr=0)
}) br['email' ] = self.username
br.open(self.LOGIN, data) br['password'] = self.password
br.submit()
return br return br
def get_feeds(self): def get_feeds(self):
self.feeds = [] self.feeds = []
soup = self.index_to_soup(self.SETTINGS) soup = self.index_to_soup(self.SETTINGS)
for item in soup.findAll('input', attrs={'type':'text'}): for item in soup.findAll('input', attrs={'type':'text'}):
if item.has_key('value') and item['value'].startswith('http://www.nsfwcorp.com/feed/'): if item.has_key('value') and item['value'].startswith('https://www.nsfwcorp.com/feed/'):
self.feeds.append(item['value']) self.feeds.append(item['value'])
return self.feeds return self.feeds
return self.feeds return self.feeds