大 中
小
第 1 則發表於 2013-09-04 23:33 - 發短訊 - 加好友
顯示全部文章
無名要關了 自己動手寫了個小工具
趕快打包吧!
1. mkdir c:\temp
2. copy/paste the script into c:\temp
3. update blogname in the script
4. run powershell.exe ".\Check-WRETCH-CC.ps1"
#######################################################################
#
# FileName: Check-WRETCH-CC.ps1
#
# Date: Sep 3, 2013 - ragebull
#
# Usage:
#
# ex: powershell.exe ".\Check-WRETCH-CC.ps1"
#
# Note: 1. please update the $blogname with your blog name
# 2. this tool will export all links to current working directory under individual filenames
# 3. the image, hyperlink etc are not changed to point to local copy, therefore
# once the online image is gone due to site closure, html page will be missing image
#
#########################################################################
#requires -version 3.0
clear-host
$blogname = "YourBlogName"
$url = "http://www.wretch.cc/blog/" + $blogname + "&list=1"
$result = Invoke-WebRequest $url -UseDefaultCredentials
$SearchToken = "http://www.wretch.cc/blog/" + $blogname + "*"
$BlogLinks = $result.links | where href -Like $SearchToken | select innerText, href
$url = $null
foreach ($_ in $BlogLinks)
{
write-host "Checking blog:" $_.innertext:
$BlogDetailURL = $_.href
$BlogDetailPage = Invoke-WebRequest $BlogDetailURL -UseDefaultCredentials
$outputFileName = ".\" + $_.innertext + ".html"
$BlogDetailPage.Content | tee-object -filepath $outputFileName
}