From 7d9a2aee8ac37d380e705d6ba0826a8067aec1a2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 5 Sep 2025 20:07:03 +0530 Subject: [PATCH] Update New York Review of Books --- recipes/new_york_review_of_books.recipe | 7 +++++-- recipes/new_york_review_of_books_no_sub.recipe | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/recipes/new_york_review_of_books.recipe b/recipes/new_york_review_of_books.recipe index d2eff8d35c..6ea1fde549 100644 --- a/recipes/new_york_review_of_books.recipe +++ b/recipes/new_york_review_of_books.recipe @@ -74,9 +74,12 @@ class NewYorkReviewOfBooks(BasicNewsRecipe): # Find TOC articles = [] - for h4 in soup.findAll('h4'): + for h4 in soup.findAll('h2'): title = self.tag_to_string(h4).strip() - url = absurl(h4.find('a')['href']) + a = h4.find('a') + if a is None: + continue + url = absurl(a['href']) author = self.tag_to_string(h4.parent.parent.find('a')) title = title + ' (%s)' % author desc = '' diff --git a/recipes/new_york_review_of_books_no_sub.recipe b/recipes/new_york_review_of_books_no_sub.recipe index e36cd9978a..dad9785f3d 100644 --- a/recipes/new_york_review_of_books_no_sub.recipe +++ b/recipes/new_york_review_of_books_no_sub.recipe @@ -64,9 +64,12 @@ class NewYorkReviewOfBooks(BasicNewsRecipe): # Find TOC articles = [] - for h4 in soup.findAll('h4'): + for h4 in soup.findAll('h2'): title = self.tag_to_string(h4).strip() - url = absurl(h4.find('a')['href']) + a = h4.find('a') + if a is None: + continue + url = absurl(a['href']) author = self.tag_to_string(h4.parent.parent.find('a')) title = title + ' (%s)' % author desc = ''