Skip to content

Commit a5c2769

Browse files
committed
Simplify link checker
... and debug a bit.
1 parent 61c26ab commit a5c2769

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ check:
5050
./check-num-pages.sh handout-tips.pdf 1
5151
./check-num-pages.sh handout-beginner.pdf 1
5252
./check-num-pages.sh handout-intermediate.pdf 1
53-
./check-links.py cheatsheets.pdf
5453
./check-diffs.py
54+
./check-links.py cheatsheets.pdf
5555

5656
.PHONY: docs
5757
docs:

check-links.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
refs = [ref for ref in pdf.get_references() if ref.reftype == 'url']
1010

11-
status_codes = list(map(lambda ref: pdfx.downloader.get_status_code(ref.ref), refs))
11+
status_codes = [pdfx.downloader.get_status_code(ref.ref) for ref in refs]
1212

13-
broken_links = [refs[idx].ref for idx in range(len(refs)) if status_codes[idx] != 200]
13+
broken_links = [(ref.ref, code) for ref, code in zip(refs, status_codes) if code != 200]
1414

1515
# it seems that Twitter does not respond well to the link checker and throws a 400
16-
if all(['twitter.com' in url for url in broken_links]):
16+
if all(['twitter.com' in url for url, _ in broken_links]):
1717
sys.exit(0)
1818
else:
1919
print('Broken links:', broken_links)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy