【发布时间】:2021-03-09 07:30:07
【问题描述】:
我正在wgeting 网页源代码,然后使用 pup 获取我需要的 <meta> 标记。现在我只想打印content 字段的值。
在这种情况下,我想要的输出是:https://example.com/my/folder/first.jpg?foo=bar
# wget page to /tmp/output.html
IMAGE_URL=$(cat /tmp/output.html | pup 'meta[property*="og:image"]')
echo $IMAGE_URL is:
<meta property="og:image" content="https://example.com/my/folder/first.jpg?foo=bar">
【问题讨论】: