StackOverflow reputation using PowerShell

后端 未结 3 510
野的像风
野的像风 2021-02-04 01:02

How can I view my reputation with a PowerShell function ?

3条回答
  •  一整个雨季
    2021-02-04 01:29

    You can use the following function

    Function Get-StackOverFlowReputation {
    param($userID)
        $client = new-object System.Net.WebClient
        $JSONFlair = $client.DownloadString("http://stackoverflow.com/users/flair/$userid.json")
        $JSONFlair.split(",") | select-string "reputation","displayName"
    }
    
    
    260 >  Get-StackOverFlowReputation -userID 45571
    
    "displayName":"Andy Schneider"
    "reputation":"344"
    

    It's quick and dirty. I am sure you could use some nifty library to convert JSON to a PSobject but this will get the job done.

提交回复
热议问题