@@ -113,35 +113,34 @@ def _build_rss_entries(
113
113
html = BeautifulSoup (newsletter_file , "html.parser" )
114
114
115
115
try :
116
- timeago = html .find ("span" , {"class" : "timeago" })
117
- if timeago is None :
116
+ if html .find ("span" , {"class" : "timeago" }) is None :
118
117
raise ValueError ("Could not find timeago" )
119
- # ignore: The object doesn't have __getitem__ defined but it still works. It's probably a typing error
120
- published = timeago ["datetime" ] # type: ignore
118
+ # ignore: The object doesn't have __getitem__ defined but it still works.
119
+ # It's probably a typing error
120
+ published = html .find ("span" , {"class" : "timeago" })[
121
+ "datetime"
122
+ ] # type: ignore
121
123
except IndexError :
122
124
published = newsletter .date .isoformat ()
123
125
124
126
# Clean the source code
125
127
126
128
# Remove the h1 as it's already in the title
127
- article = html .article
128
- if article is None :
129
+ if html .article is None :
129
130
raise ValueError ("Could not find the article" )
130
- h1 = article .h1
131
- if h1 is None :
131
+ if html .article .h1 is None :
132
132
raise ValueError ("Could not find h1 title" )
133
- title = h1 .text
134
- h1 .extract ()
133
+ title = html . article . h1 .text
134
+ html . article . h1 .extract ()
135
135
136
136
# Remove the Last updated: line
137
137
with suppress (AttributeError ):
138
- div = article .div
139
- if div is None :
140
- pass
141
- div .extract ()
138
+ if html .article .div is None :
139
+ raise AttributeError
140
+ html .article .div .extract ()
142
141
143
142
# Remove the permalinks
144
- for permalink in article .find_all ("a" , {"class" : "headerlink" }):
143
+ for permalink in html . article .find_all ("a" , {"class" : "headerlink" }):
145
144
permalink .extract ()
146
145
147
146
description = re .sub (
0 commit comments