Skip to content

Commit

Permalink
mckinsey: less selector specificity but probably still enough (#162)
Browse files Browse the repository at this point in the history
McKinsey's class names have not been totally stable, but the link order seems to be. I think it's enough to grab the first one that matches this path start
  • Loading branch information
thisisparker authored Jan 9, 2024
1 parent 0fc4758 commit 8b37e9d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions xword_dl/downloader/mckinseydownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def find_latest(self):
index_res = requests.get(index_url)
index_soup = BeautifulSoup(index_res.text, "html.parser")

latest_fragment = next(a for a in index_soup.select('a.mdc-c-link-heading[href^="/featured-insights/the-mckinsey-crossword/"]')
if a.find('div'))['href']
latest_fragment = next(a for a in index_soup.select('a[href^="/featured-insights/the-mckinsey-crossword/"]') if a.find('div'))['href']
latest_absolute = urllib.parse.urljoin('https://www.mckinsey.com',
latest_fragment)

Expand Down

0 comments on commit 8b37e9d

Please sign in to comment.