mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update NSFW. Fixes #1178221 (Updated recipe for Not Safe For Work)
This commit is contained in:
parent
bcb19457e2
commit
4c58c6b0ef
@ -1,6 +1,5 @@
|
||||
|
||||
__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
|
||||
'''
|
||||
@ -20,8 +19,8 @@ class NotSafeForWork(BasicNewsRecipe):
|
||||
needs_subscription = True
|
||||
auto_cleanup = False
|
||||
INDEX = 'https://www.nsfwcorp.com'
|
||||
LOGIN = INDEX + '/login/target/'
|
||||
SETTINGS = INDEX + '/settings/'
|
||||
LOGIN = INDEX + '/account/login/?next=%2F'
|
||||
SETTINGS = INDEX + '/account/settings/'
|
||||
use_embedded_content = True
|
||||
language = 'en'
|
||||
publication_type = 'magazine'
|
||||
@ -48,19 +47,20 @@ class NotSafeForWork(BasicNewsRecipe):
|
||||
|
||||
def 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:
|
||||
data = urllib.urlencode({ 'email':self.username
|
||||
,'password':self.password
|
||||
})
|
||||
br.open(self.LOGIN, data)
|
||||
br.open(self.LOGIN)
|
||||
br.select_form(nr=0)
|
||||
br['email' ] = self.username
|
||||
br['password'] = self.password
|
||||
br.submit()
|
||||
return br
|
||||
|
||||
|
||||
def get_feeds(self):
|
||||
self.feeds = []
|
||||
soup = self.index_to_soup(self.SETTINGS)
|
||||
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'])
|
||||
return self.feeds
|
||||
return self.feeds
|
||||
|
Loading…
x
Reference in New Issue
Block a user