Skip to content

Instantly share code, notes, and snippets.

@KevinNitroG
Created November 6, 2024 07:47
Show Gist options
  • Save KevinNitroG/bd49f18fe614cfe4d973bfd68bd77938 to your computer and use it in GitHub Desktop.
Save KevinNitroG/bd49f18fe614cfe4d973bfd68bd77938 to your computer and use it in GitHub Desktop.
download image from weibo
Get-Clipboard > _test.html
prettier _test.html | Select-String -Pattern 'src="' | ForEach-Object {
if ($_ -match 'src="([^"]+)"')
{
$url = $matches[1]
curl --header "Referer: https://m.weibo.cn/" --header "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" --header "Sec-Fetch-Site: cross-site" --output $([System.IO.Path]::GetFileName($url)) $url
}
}
Remove-Item -Path _test.html -Force
#!/usr/bin/env bash
if [[ $(grep -i Microsoft /proc/version) ]]; then
clippaste >_test.html
else
exit 1
fi
prettier _test.html | sed 's/.*src=\"\(.*\)\"/\1/' | xargs -I {} wget --header "referer: https://m.weibo.cn/" --header "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" --header "sec-fetch-site: cross-site" {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment