From beb984754e3c2cfe55c729a0a4e7c782d8d2e2f8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 25 Sep 2025 23:47:37 +0530 Subject: [PATCH] Live load clean_js_json in all NYT recipes --- recipes/nytimes.recipe | 3 ++- recipes/nytimes_sub.recipe | 3 ++- recipes/nytimesbook.recipe | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/recipes/nytimes.recipe b/recipes/nytimes.recipe index 97491bca46..a53888ee58 100644 --- a/recipes/nytimes.recipe +++ b/recipes/nytimes.recipe @@ -258,7 +258,8 @@ class NewYorkTimes(BasicNewsRecipe): def preloaded_data(soup): - from calibre.web.site_parsers.nytimes import clean_js_json + from calibre.live import load_module + clean_js_json = load_module('calibre.web.site_parsers.nytimes').clean_js_json candidates = soup.find_all('script', string=lambda x: x and 'window.__preloadedData' in x) script = candidates[0] script = str(script) diff --git a/recipes/nytimes_sub.recipe b/recipes/nytimes_sub.recipe index 05120ae68d..671bf079a4 100644 --- a/recipes/nytimes_sub.recipe +++ b/recipes/nytimes_sub.recipe @@ -258,7 +258,8 @@ class NewYorkTimes(BasicNewsRecipe): def preloaded_data(soup): - from calibre.web.site_parsers.nytimes import clean_js_json + from calibre.live import load_module + clean_js_json = load_module('calibre.web.site_parsers.nytimes').clean_js_json candidates = soup.find_all('script', string=lambda x: x and 'window.__preloadedData' in x) script = candidates[0] script = str(script) diff --git a/recipes/nytimesbook.recipe b/recipes/nytimesbook.recipe index 9161a55ff5..6962dc4336 100644 --- a/recipes/nytimesbook.recipe +++ b/recipes/nytimesbook.recipe @@ -126,7 +126,8 @@ def asset_to_article(asset): def preloaded_data(soup): - from calibre.web.site_parsers.nytimes import clean_js_json + from calibre.live import load_module + clean_js_json = load_module('calibre.web.site_parsers.nytimes').clean_js_json candidates = soup.find_all('script', string=lambda x: x and 'window.__preloadedData' in x) script = candidates[0] script = str(script)