From 90967016cc2c73391b3304d21e187780a21f021a Mon Sep 17 00:00:00 2001
From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com>
Date: Sun, 26 Nov 2023 17:33:05 +0530
Subject: [PATCH] ...
---
recipes/ifzm.recipe | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/recipes/ifzm.recipe b/recipes/ifzm.recipe
index a8f72c66f0..9d46bd6b84 100644
--- a/recipes/ifzm.recipe
+++ b/recipes/ifzm.recipe
@@ -1,6 +1,16 @@
from calibre.web.feeds.news import BasicNewsRecipe
import json
+def json_to_html(raw, link):
+ data = json.loads(raw)
+ data = data['data']['content']
+ title = '
'.format(link) + data['subject'] + '
'
+ auth = '' + data['author'] + '
'
+ sub = '' + data['introtext'] + '
'
+ body = data['fulltext']
+ return '' + title + auth + sub + body + '
'
+
+
class infzm(BasicNewsRecipe):
title = '南方周末'
__author__ = 'unkn0wn'
@@ -13,6 +23,7 @@ class infzm(BasicNewsRecipe):
remove_empty_feeds = True
use_embedded_content = False
remove_attributes = ['style', 'height', 'width']
+ masthead_url = 'http://ssimg.kkod.cn/web/02/14227.gif'
articles_are_obfuscated = True
@@ -28,15 +39,9 @@ class infzm(BasicNewsRecipe):
link = soup.find('a', href=True)['href'].split('?')[0]
res_link = link.replace('https://www.infzm.com', 'https://api.infzm.com/mobile') \
+ '?platform=wap&version=1.89.0&machine_id=35458aa29603f2b246636e5492122b50&user_id=&token=&member_type='
+ # if article is paywalled, add code to figure out machine_id
raw = br.open(res_link).read()
- data = json.loads(raw)
- data = data['data']
- content = data['content']
- title = ''.format(link) + content['subject'] + '
'
- auth = '' + content['author'] + '
'
- sub = '' + content['introtext'] + '
'
- body = content['fulltext']
- html = '' + title + auth + body + '
'
+ html = json_to_html(raw, link)
return ({ 'data': html, 'url': link })
extra_css = '''