This is a rewrite of the (currently closed) "Debunking Stroustrup's debunking of the myth “C++ is for large, complicated, programs only”" challenge.
Challenge
Write the shortest program or function that will:
- Download
http://www.stroustrup.com/C++.html
, and - List all URLs contained in the HTML document.
A "URL" for this challenge is
- some string of characters
- contained in the
href
attribute of an<a>
tag - that starts with
http://
orhttps://
.
So <a href="someotherpage.html">
doesn't have a URL, but <a href="http://someotherpage.html">
does.
Additional Rules
- You may assume the downloaded HTML is valid.
- You may not assume the input is static: you must download the page each time your code is run.
- (as a consequence of above) You may not hardcode the output URLs: this is not kolmogorov-complexity, this is parsing.
- You may use either
http://www.stroustrup.com/C++.html
orhttps://www.stroustrup.com/C++.html
as your source URL.
Validation
The first 5 URLs on the page (based on a snapshot of the site on April 3, 2023) are:
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md
http://webhostinggeeks.com/science/programming-language-be
https://coderseye.com/stroustrup-the-c-programming-language
http://edutranslator.com/jazyk-programmirovanija-c/
https://pngset.com/uz-cplusplus
There are 91 URLs in this particular snapshot.
f="http
, which could produce false positives? \$\endgroup\$