Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
fix: access to download binary from mirror sites
Browse files Browse the repository at this point in the history
  • Loading branch information
liuye.adam committed Dec 12, 2019
1 parent 2341826 commit 7751e65
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,12 @@ Tests are written with [vows](http://vowsjs.org/)
npm test
```

### Environment Variables

Youtube-dl looks for certain environment variables to aid its operations. If Youtube-dl doesn't find them in the environment during the installation step, a lowercased variant of these variables will be used from the [npm config](https://docs.npmjs.com/cli/config) or [yarn config](https://yarnpkg.com/lang/en/docs/cli/config/).

- YOUTUBE\_DL\_DOWNLOAD\_HOST - overwrite URL prefix that is used to download the binary file of Youtube-dl. Note: this includes protocol and might even include path prefix. Defaults to `https://yt-dl.org/downloads/latest/youtube-dl`

## License

MIT
Expand Down
4 changes: 3 additions & 1 deletion lib/downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ const isWin = flags.includes('--platform=windows') || require('./util').isWin
let dir, filePath
const defaultBin = path.join(__dirname, '..', 'bin')
const defaultPath = path.join(defaultBin, 'details')
const url = 'https://yt-dl.org/downloads/latest/youtube-dl'
const url = process.env.YOUTUBE_DL_DOWNLOAD_HOST
|| process.env.youtube_dl_download_host
|| 'https://yt-dl.org/downloads/latest/youtube-dl'

function download (url, callback) {
let status
Expand Down

0 comments on commit 7751e65

Please sign in to comment.