有趣的NatGeo Powershell脚本…需要工作

有趣的NatGeo Powershell脚本…需要工作,powershell,Powershell,我拼凑了以下脚本: $page=iwr 我似乎无法解析列表以找到当天的真实照片,甚至无法下载与.images.src相关的链接。任何帮助都将不胜感激。试试以下方法: $folder = 'c:\temp\natgeopics' if (!(Test-Path $folder)) { md $folder | Out-Null } (iwr http://photography.nationalgeographic.com/photography/photo-of-the-day).Image

我拼凑了以下脚本:

$page=iwr

我似乎无法解析列表以找到当天的真实照片,甚至无法下载与.images.src相关的链接。任何帮助都将不胜感激。

试试以下方法:

$folder = 'c:\temp\natgeopics'

if (!(Test-Path $folder)) { md $folder | Out-Null }

(iwr http://photography.nationalgeographic.com/photography/photo-of-the-day).Images.src | ? {$_ -match [regex]::escape('images.nationalgeographic.com/wpf/media-live/photos')} | select -f 1 | % {iwr "http:$_" -OutFile $folder\$(Get-Date -f yyyyMMdd)$(Split-Path $_ -Leaf)}

start $folder
$folder = 'c:\temp\natgeopics'

if (!(Test-Path $folder)) { md $folder | Out-Null }

(iwr http://photography.nationalgeographic.com/photography/photo-of-the-day).Images.src | ? {$_ -match [regex]::escape('images.nationalgeographic.com/wpf/media-live/photos')} | select -f 1 | % {iwr "http:$_" -OutFile $folder\$(Get-Date -f yyyyMMdd)$(Split-Path $_ -Leaf)}

start $folder