Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to download a file from github in a local directory using PowerShell

I am looking for a way to download a specific file from github using a PowerShell commands.

The URL to the file that I try to download is the following: https://github.com/soulcurrymedia/twitter-emotion-recognition/blob/master/models/allowed-chars.pkl

I have tried the following but it has downloaded html script rather than the actual file

$url = "https://github.com/soulcurrymedia/twitter-emotion-recognition/blob/master/models/allowed-chars.pkl"

$output = "C:\code\queues\models\allowed-chars.pkl"

Invoke-WebRequest -Uri $url -OutFile $output

I am new to PowerShell so any help will be much appreciated.

like image 222
Stamatis Tiniakos Avatar asked Nov 04 '25 16:11

Stamatis Tiniakos


2 Answers

You need to use a direct-download link for it to work. In this case the link is:

https://github.com/soulcurrymedia/twitter-emotion-recognition/raw/master/models/allowed-chars.pkl
like image 81
Salve Avatar answered Nov 06 '25 10:11

Salve


Use this link for download the file:

https://github.com/soulcurrymedia/twitter-emotion-recognition/raw/master/models/allowed-chars.pkl

like image 35
Farbkreis Avatar answered Nov 06 '25 10:11

Farbkreis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!