Skip to content

Instantly share code, notes, and snippets.

@sjorspa
Last active September 20, 2024 07:09
Show Gist options
  • Save sjorspa/ca3e9c371a23100447c0a59ad0d8f6ca to your computer and use it in GitHub Desktop.
Save sjorspa/ca3e9c371a23100447c0a59ad0d8f6ca to your computer and use it in GitHub Desktop.
$cont = $true
$next_cursor = ''
$list = New-Object Collections.Generic.List[String]
cls
while($cont){
$result = Invoke-WebRequest -UseBasicParsing -Uri "https://vsco.co/api/3.0/medias/profile?site_id=profileid&limit=14&cursor=$($next_cursor)" `
-Headers @{
"authority"="vsco.co"
"path"="/api/3.0/medias/profile?site_id=profileid&limit=14&cursor=$($next_cursor)"
"authorization"="Bearer xxxxxxxxxxxxxxxxxxxxxxxxxx"
} `
-ContentType "application/json"
$result = $result.Content | ConvertFrom-Json -Depth 50
foreach($item in $result.media){
$plaatje = $item.image.responsive_url.Split('/') | Select-Object -Last 1
if(!$list.Contains($plaatje)){
$list.Add($plaatje)
Invoke-RestMethod $item.image.responsive_url -OutFile "C:\vsco\$($plaatje | Select-Object -Last 1)"
}
else{
Write-Output 'Dubbel'
}
#Write-Output $plaatje | Select-Object -Last 1
#Invoke-RestMethod $item.image.responsive_url -OutFile "C:\vsco\$($plaatje | Select-Object -Last 1)"
}
if($result.next_cursor -ne ''){
$next_cursor = [uri]::EscapeDataString($result.next_cursor)
Write-Output $result.next_cursor
}
else{
$cont = $false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment