mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
7654f34b69
commit
61dc642c42
@ -1,8 +1,9 @@
|
||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||
import mechanize
|
||||
import json
|
||||
from mechanize import Request
|
||||
from datetime import datetime
|
||||
|
||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||
|
||||
|
||||
class Nzz(BasicNewsRecipe):
|
||||
title = 'NZZ'
|
||||
@ -80,19 +81,19 @@ class Nzz(BasicNewsRecipe):
|
||||
encoded_data = json.dumps(json_data).encode('utf-8')
|
||||
|
||||
# Create a mechanize Request object with the target URL, encoded data, and headers
|
||||
req = mechanize.Request(url='https://epaper.nzz.ch/epaper/1.0/findEditionsFromDate',
|
||||
req = Request(url='https://epaper.nzz.ch/epaper/1.0/findEditionsFromDate',
|
||||
data=encoded_data,
|
||||
headers=headers,
|
||||
method='POST')
|
||||
|
||||
# Use mechanize to open the request and read the response
|
||||
browser = mechanize.Browser()
|
||||
browser = self.get_browser()
|
||||
response = browser.open(req)
|
||||
response_data = json.loads(response.read())
|
||||
|
||||
# Extract the desired information
|
||||
url = response_data['data'][0]['pages'][0]['pageDocUrl']['PREVIEW']['url']
|
||||
|
||||
|
||||
return url
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user