【发布时间】:2016-10-04 06:05:49
【问题描述】:
我正在尝试制作一个 bash 脚本,该脚本将下载一个 youtube 页面,查看最新视频并找到它的 url。我有下载页面的部分,除了我不知道如何用 url 隔离文本。 我有这个下载页面
curl -s https://www.youtube.com/user/h3h3Productions/videos > YoutubePage.txt
这会将其保存到文件中。 但我无法弄清楚如何隔离 div 的单个部分。 div是
<a class="yt-uix-sessionlink yt-uix-tile-link spf-link yt-ui-ellipsis yt-ui-ellipsis-2" dir="ltr" title="Why I'm Unlisting the Leafyishere Rant" aria-describedby="description-id-877692" data-sessionlink="ei=a2lSV9zEI9PJ-wODjKuICg&feature=c4-videos-u&ved=CD4QvxsiEwicpteI1I3NAhXT5H4KHQPGCqEomxw" href="/watch?v=q6TNODqcHWA">Why I'm Unlisting the Leafyishere Rant</a>
我需要在最后隔离 href 但我不知道如何使用 grep 或 sed 来做到这一点。
【问题讨论】:
-
edit 您的问题包括将产生该输出的示例输入 (
The div is)。套用空手道小子 3 的话说,“一个人看不见,他无法解析”。