This commit is contained in:
Kovid Goyal 2023-10-23 13:12:35 +05:30
parent 74bb2c4c9d
commit f316dea0ad
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -10,6 +10,7 @@ from base64 import standard_b64encode
from datetime import date, timedelta
from mechanize import Request
from calibre.ptempfile import PersistentTemporaryFile
from calibre.web.feeds.news import BasicNewsRecipe
from css_selectors import Select
@ -22,12 +23,9 @@ try:
except ImportError:
from urllib import quote
from calibre.scraper.simple import read_url
from calibre.ptempfile import PersistentTemporaryFile
needs_subscription = False
class WSJ(BasicNewsRecipe):
if needs_subscription:
@ -52,7 +50,7 @@ class WSJ(BasicNewsRecipe):
extra_css = '''
#big-top-caption { font-size:small; text-align:center; }
[data-type:"tagline"] { font-style:italic; color:#202020; }
[data-type:"tagline"], em { font-style:italic; color:#202020; }
.auth { font-size:small; }
.sub, em, i { color: #202020; }
'''
@ -75,6 +73,7 @@ class WSJ(BasicNewsRecipe):
articles_are_obfuscated = True
def get_obfuscated_article(self, url):
from calibre.scraper.simple import read_url
br = self.get_browser()
br.set_handle_redirect(False)
try:
@ -116,7 +115,6 @@ class WSJ(BasicNewsRecipe):
parent['class'] = 'auth'
return soup
# login {{{
def get_browser_for_wsj(self, *a, **kw):
@ -126,7 +124,7 @@ class WSJ(BasicNewsRecipe):
br.set_cookie('ccpaApplies', 'false', '.wsj.com')
return br
if needs_subscription:
if False and needs_subscription: # disabled as we currently use archive.is
def get_browser(self, *a, **kw):
from pprint import pprint
pprint