DJ Mogarych
03-08-2020, 16:18
Привет!
Собственно, сабж. Есть ролик, под ним описание. Как Invoke-WebRequest или PowerHTML может вытащить этот текст с сайта?
И главный вопрос - как можно научиться, в каком направлении искать? Тот же Invoke-WebRequest выдаёт 100500 методов:
$url = Invoke-WebRequest https://www.youtube.com/watch?v=HZTStHzWRxM
$url.parsedhtml
Положим, я в Файрфоксе нашёл нужный кусок:
<div id="description" slot="content" class="style-scope ytd-video-secondary-info-renderer"><yt-formatted-string class="content style-scope ytd-video-secondary-info-renderer" force-default-style="" split-lines=""><span dir="auto" class="style-scope yt-formatted-string">Don't know what its actual name is, so I just threw every word into this video's title and hoped that something stuck.
</span><a class="yt-simple-endpoint style-scope yt-formatted-string" spellcheck="false" href="/watch?v=HZTStHzWRxM&t=0s" dir="auto">0:00</a><span dir="auto" class="style-scope yt-formatted-string"> - The new feature
</span><a class="yt-simple-endpoint style-scope yt-formatted-string" spellcheck="false" href="/watch?v=HZTStHzWRxM&t=17s" dir="auto">0:17</a><span dir="auto" class="style-scope yt-formatted-string"> - Slow roll-out
</span><a class="yt-simple-endpoint style-scope yt-formatted-string" spellcheck="false" href="/watch?v=HZTStHzWRxM&t=76s" dir="auto">1:16</a><span dir="auto" class="style-scope yt-formatted-string"> - How it works
</span><a class="yt-simple-endpoint style-scope yt-formatted-string" spellcheck="false" href="/watch?v=HZTStHzWRxM&t=124s" dir="auto">2:04</a><span dir="auto" class="style-scope yt-formatted-string"> - Problems / suggestions for the future</span></yt-formatted-string></div>
Но как до этого добраться в Powershell?
Собственно, сабж. Есть ролик, под ним описание. Как Invoke-WebRequest или PowerHTML может вытащить этот текст с сайта?
И главный вопрос - как можно научиться, в каком направлении искать? Тот же Invoke-WebRequest выдаёт 100500 методов:
$url = Invoke-WebRequest https://www.youtube.com/watch?v=HZTStHzWRxM
$url.parsedhtml
Положим, я в Файрфоксе нашёл нужный кусок:
<div id="description" slot="content" class="style-scope ytd-video-secondary-info-renderer"><yt-formatted-string class="content style-scope ytd-video-secondary-info-renderer" force-default-style="" split-lines=""><span dir="auto" class="style-scope yt-formatted-string">Don't know what its actual name is, so I just threw every word into this video's title and hoped that something stuck.
</span><a class="yt-simple-endpoint style-scope yt-formatted-string" spellcheck="false" href="/watch?v=HZTStHzWRxM&t=0s" dir="auto">0:00</a><span dir="auto" class="style-scope yt-formatted-string"> - The new feature
</span><a class="yt-simple-endpoint style-scope yt-formatted-string" spellcheck="false" href="/watch?v=HZTStHzWRxM&t=17s" dir="auto">0:17</a><span dir="auto" class="style-scope yt-formatted-string"> - Slow roll-out
</span><a class="yt-simple-endpoint style-scope yt-formatted-string" spellcheck="false" href="/watch?v=HZTStHzWRxM&t=76s" dir="auto">1:16</a><span dir="auto" class="style-scope yt-formatted-string"> - How it works
</span><a class="yt-simple-endpoint style-scope yt-formatted-string" spellcheck="false" href="/watch?v=HZTStHzWRxM&t=124s" dir="auto">2:04</a><span dir="auto" class="style-scope yt-formatted-string"> - Problems / suggestions for the future</span></yt-formatted-string></div>
Но как до этого добраться в Powershell?