summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--unbiased/sources/fox.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/unbiased/sources/fox.py b/unbiased/sources/fox.py
index 63f853e..55de92b 100644
--- a/unbiased/sources/fox.py
+++ b/unbiased/sources/fox.py
@@ -20,15 +20,17 @@ class Fox(NewsSource):
"""
soup = cls._fetch_content(cls.url)
- primary = soup.find('div', class_='main-primary')\
- .find('div', class_='collection-spotlight')\
- .find_all('article', class_='article')
- h1s = (primary[0].find('header', class_='info-header').find('a')['href'],)
- h2s = tuple(x.find('header', class_='info-header').find('a')['href'] for x in primary[1:])
+ hero = soup.select('div.collection-spotlight.has-hero .title a')
+ related = soup.select('div.collection-spotlight.has-hero .related a')
+ h1s = [x['href'] for x in hero + related if 'live-news' not in x['href']][:1]
+
+ h2s = soup.select('div.collection-spotlight .title a')
+ h2s = [x['href'] for x in h2s if 'live-news' not in x['href']]
+ h2s = set(h2s) - set(h1s)
- h3s = soup.find('div', class_='main-primary')\
- .find('div', class_='collection-article-list')\
+ h3s = soup.find('div', class_='collection-article-list')\
.find_all('article', class_='article')
- h3s = tuple(x.find('header', class_='info-header').find('h2', class_='title').find('a')['href'] for x in h3s)
+ h3s = tuple(x.find('header', class_='info-header')\
+ .find('h2', class_='title').find('a')['href'] for x in h3s)
return h1s, h2s, h3s