mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
68 lines
2.9 KiB
Plaintext
68 lines
2.9 KiB
Plaintext
|
|
__license__ = 'GPL v3'
|
|
__copyright__ = '2012, Darko Miletic <darko.miletic at gmail.com>'
|
|
'''
|
|
www.nsfwcorp.com
|
|
'''
|
|
|
|
import urllib
|
|
from calibre.web.feeds.news import BasicNewsRecipe
|
|
|
|
class NotSafeForWork(BasicNewsRecipe):
|
|
title = 'Not Safe For Work Corporation'
|
|
__author__ = 'Darko Miletic'
|
|
description = 'Not Safe For Work Corporation'
|
|
publisher = 'Not Safe For Work Corporation'
|
|
category = 'news, politics, USA, World'
|
|
no_stylesheets = True
|
|
oldest_article = 15
|
|
encoding = 'utf-8'
|
|
needs_subscription = True
|
|
auto_cleanup = False
|
|
INDEX = 'https://www.nsfwcorp.com'
|
|
LOGIN = INDEX + '/login/target/'
|
|
SETTINGS = INDEX + '/settings/'
|
|
use_embedded_content = True
|
|
language = 'en'
|
|
publication_type = 'magazine'
|
|
masthead_url = 'http://assets.nsfwcorp.com/media/headers/nsfw_banner.jpg'
|
|
extra_css = """
|
|
body{font-family: Constantia,"Lucida Bright",Lucidabright,"Lucida Serif",Lucida,"DejaVu Serif","Bitstream Vera Serif","Liberation Serif",Georgia,serif}
|
|
img{margin-top:0.5em; margin-bottom: 0.7em; display: block}
|
|
.fontFace{font-family: 'LeagueGothicRegular',Arial,sans-serif;}
|
|
.dispatchTitle{text-transform: uppercase; font-size: x-large; font-weight: bold}
|
|
.dispatchSubtitle{font-size: x-large; font-weight: bold}
|
|
#fromLine{color: gray; text-align:right}
|
|
#toLine{color: gray}
|
|
#toLine a{color: red}
|
|
#fromLine a{color: red}
|
|
.row a{color: red}
|
|
"""
|
|
|
|
conversion_options = {
|
|
'comment' : description
|
|
, 'tags' : category
|
|
, 'publisher' : publisher
|
|
, 'language' : language
|
|
}
|
|
|
|
def get_browser(self):
|
|
br = BasicNewsRecipe.get_browser()
|
|
br.open(self.LOGIN)
|
|
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)
|
|
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/'):
|
|
self.feeds.append(item['value'])
|
|
return self.feeds
|
|
return self.feeds
|
|
|