This commit is contained in:
unkn0w7n 2023-09-05 18:18:38 +05:30
parent dd9b8ba1c8
commit b72ebeb095

View File

@ -120,6 +120,11 @@ class NatGeo(BasicNewsRecipe):
.auth, .time { font-size:small; color:#5c5c5c; } .auth, .time { font-size:small; color:#5c5c5c; }
''' '''
def get_cover_url(self):
soup = self.index_to_soup('https://ngsingleissues.nationalgeographic.com/history')
wrap = soup.find(attrs={'class':'product-image-wrapper'})
return wrap.img['src']
def parse_index(self): def parse_index(self):
soup = self.index_to_soup('https://www.nationalgeographic.com/history/history-magazine') soup = self.index_to_soup('https://www.nationalgeographic.com/history/history-magazine')
ans = [] ans = []
@ -134,7 +139,7 @@ class NatGeo(BasicNewsRecipe):
def preprocess_raw_html(self, raw_html, url): def preprocess_raw_html(self, raw_html, url):
data = extract_json(raw_html) data = extract_json(raw_html)
return '\n'.join(article_parse(data)) return '\n'.join(article_parse(data))
def preprocess_html(self, soup): def preprocess_html(self, soup):
for img in soup.findAll('img', src=True): for img in soup.findAll('img', src=True):
img['src'] = img['src'] + '?w=1000&h=1000' img['src'] = img['src'] + '?w=1000&h=1000'