Revision: 50513
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 25, 2011 05:23 by danfsmith
Initial Code
param ($url, $tofind, $agilitypackpath="f:\dan\tools\html-agility-pack\HtmlAgilityPack.dll", $xpath="//a")
add-type -Path $agilitypackpath
$client = New-Object System.Net.WebClient
$contents = $client.DownloadString($url)
$doc = New-Object HtmlAgilityPack.HtmlDocument
$htmldoc = $doc.LoadHtml($contents)
$linknodes = $doc.DocumentNode.SelectNodes($xpath)
foreach ($node in $linknodes)
{
$link = $node.GetAttributeValue("href", "")
if ($link)
{
$c = $client.DownloadString($link)
if ($c.Contains($tofind))
{
$isfound = "true";
}
else
{
$isfound = "false";
}
New-Object PsObject -Property @{Url = $link; IsFound = $isfound;}
}
}
Initial URL
Initial Description
Initial Title
Check destinations of a list of links in a document for a string
Initial Tags
html
Initial Language
Windows PowerShell