Created
June 21, 2014 12:28
-
-
Save dfinke/6c4a7064651e66a4713d to your computer and use it in GitHub Desktop.
Download Github Emojis Using PowerShell Workflow
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
workflow Get-GithubEmojis { | |
param($TargetPath="c:\temp\emojis") | |
if(!(Test-Path -Path $TargetPath)) { | |
$null= New-Item -ItemType Directory -Path $TargetPath | |
} | |
$emojis = Invoke-RestMethod -Uri https://api.github.com/emojis | |
$names = ($emojis | Get-Member -MemberType NoteProperty).name | |
$records = $names | ForEach { | |
$target=$emojis.$PSItem | |
[PSCustomObject]@{ | |
FileName=(Split-Path -Leaf $target) -replace "\?v5", "" | |
Url=$target | |
} | |
} | |
ForEach -Parallel ($record in $records) | |
{ | |
try { | |
Invoke-RestMethod -Uri $record.Url -OutFile (Join-Path -Path $TargetPath -ChildPath $record.FileName) | |
} catch {} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment