Created
November 6, 2024 07:47
-
-
Save KevinNitroG/bd49f18fe614cfe4d973bfd68bd77938 to your computer and use it in GitHub Desktop.
download image from weibo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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