YnS*_*Skn 5 wget curl source-code
curl //website//
将为我提供源代码,但从那里我将如何过滤我们的每条唯一路径并获得它们的数量?
问题:
使用您机器上的 cURL 获取“https://www.inlanefreight.com”网站的源代码并过滤该域的所有唯一路径。提交这些路径的数量作为答案。
从问题中,我不知道“唯一路径”的含义,但我认为它的含义类似于您从执行中获得的内容
$wget -p
我使用了这种方法并且它以某种方式起作用
wget --spider --recursive https://www.inlanefreight.com
Run Code Online (Sandbox Code Playgroud)
这将显示
Found 10 broken links.
https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.svg
https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.eot
https://www.inlanefreight.com/wp-content/themes/ben_theme/images/testimonial-back.jpg
https://www.inlanefreight.com/wp-content/themes/ben_theme/css/grabbing.png
https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.woff
https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.woff2
https://www.inlanefreight.com/wp-content/themes/ben_theme/images/subscriber-back.jpg
https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.eot?
https://www.inlanefreight.com/wp-content/themes/ben_theme/images/fun-back.jpg
https://www.inlanefreight.com/wp-content/themes/ben_theme/fonts/glyphicons-halflings-regular.ttf
FINISHED --2020-12-06 05:34:58--
Total wall clock time: 2.5s
Downloaded: 23 files, 794K in 0.1s (5.36 MB/s)
Run Code Online (Sandbox Code Playgroud)
在底部。假设 23 次下载和 10 个断开的链接加起来就是我得到的唯一路径 33,这是正确的答案。
TL;DR;:你不能。
\n来自 wget 联机帮助页:
\n\xe2\x80\x9c-p 此选项使 Wget 下载正确显示给定 HTML 页面所需的所有文件。这包括内联图像、声音和引用的样式表等内容。\xe2\x80\x9d
\n这是 的一个特点wget。curl是一个执行单个http命令(简化)的软件/库。wget具有一些功能,例如下载整个网站和需要解释内容的内容。虽然这在 Web 1.0 时代有效,但此功能不再很有用,因为网站通过 javascript 加载其他文件,而这些文件甚至不会被wget. https://www.inlanefreight.com的网站是一个 wordpress 网站,主题来自https://themeansar.com/,因此您可以从那里购买它,解释它,编写脚本并希望您做得正确。
但是来吧,https://www.inlanefreight.com有 6 页和一个 pdf 文件;你可以通过点击来计算它,这比我需要找出它是 wordpress 的速度要快。
\n