This commit is contained in:
Kovid Goyal 2025-01-05 14:52:18 +05:30
parent d2ff5bb2dd
commit bff5e922ae
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 3 additions and 4 deletions

View File

@ -2,7 +2,6 @@
# vim:fileencoding=utf-8 # vim:fileencoding=utf-8
import json import json
import re import re
from datetime import date
from calibre.web.feeds.news import BasicNewsRecipe, classes from calibre.web.feeds.news import BasicNewsRecipe, classes

View File

@ -11,8 +11,8 @@ lwn.net
import re import re
import sys import sys
from calibre.web.feeds.news import BasicNewsRecipe
from calibre.utils.date import now as nowf from calibre.utils.date import now as nowf
from calibre.web.feeds.news import BasicNewsRecipe
class WeeklyLWN(BasicNewsRecipe): class WeeklyLWN(BasicNewsRecipe):
@ -85,9 +85,9 @@ class WeeklyLWN(BasicNewsRecipe):
def publication_date(self): def publication_date(self):
return self.pub_date return self.pub_date
def parse_publication_date(self, soup): def parse_publication_date(self, soup):
from dateutil.parser import parse, ParserError from dateutil.parser import ParserError, parse
try: try:
date_match = re.match(r'.* +for +([^\[]*)', self.tag_to_string(soup.head.title.string)) date_match = re.match(r'.* +for +([^\[]*)', self.tag_to_string(soup.head.title.string))
# dateutil.parser.parse() is considered thread-safe # dateutil.parser.parse() is considered thread-safe