forked from baurmatt/instagram-image-dumper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
instagram-image-dumper.ps1
executable file
·31 lines (24 loc) · 1.18 KB
/
instagram-image-dumper.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
###############################
# Create by baurmatt@2013
# instagram-image-dumper.ps1
# Description: Script which downloads all images from Instagram for the specified user
###############################
$UserName = "alanarblanchard"
$DownloadPath = "D:\Downloads\-1- Instagram Test"
#############################################
# Nothing to change for you below this line #
#############################################
$JsonData = Invoke-WebRequest "http://instagram.com/$UserName/media" | ConvertFrom-Json
$UserDownloadPath = Join-Path -Path $DownloadPath -ChildPath $UserName
if(!(Test-Path $UserDownloadPath)){New-Item -ItemType Directory -Path $UserDownloadPath}
while($JsonData.more_available -eq $true){
foreach($item in $JsonData.items){
$ImageURL = $item.images.standard_resolution.url
$ImageDownloadPath = Join-Path -Path $UserDownloadPath -ChildPath $ImageURL.Split('/')[-1]
if(!(Test-Path $ImageDownloadPath)){
Invoke-WebRequest $ImageURL -OutFile $ImageDownloadPath
}
}
$LastID = ($JsonData.items | Select -Last 1).id
$JsonData = Invoke-WebRequest "http://instagram.com/$UserName/media?max_id=$LastID" | ConvertFrom-Json
}