Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2014-04-23 13:24:12 +0400
committerFeross Aboukhadijeh <feross@feross.org>2014-04-23 13:52:05 +0400
commit1d69988e9fde758af43276eb90f5620ced4bd268 (patch)
tree8503846ec96f395742fd83d8aa030ae3f36a8f3a /bin
parent52ed7d792bdcbdf60e89c3791d340055ddaf9e9f (diff)
support http urls
Diffstat (limited to 'bin')
-rwxr-xr-xbin/cmd.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/cmd.js b/bin/cmd.js
index a6bfab6..0cb254b 100755
--- a/bin/cmd.js
+++ b/bin/cmd.js
@@ -4,8 +4,10 @@
var chalk = require('chalk')
var clivas = require('clivas')
+var concat = require('concat-stream')
var cp = require('child_process')
var fs = require('fs')
+var http = require('http')
var minimist = require('minimist')
var os = require('os')
var path = require('path')
@@ -68,6 +70,17 @@ if (subtitles) {
MPLAYER_EXEC += ' -sub ' + subtitles
}
+if (/^https?:/.test(url)) {
+ http.get(url, function (res) {
+ res.pipe(concat(function (torrent) {
+ onTorrent(torrent)
+ }))
+ }).on('error', function (err) {
+ console.error('Error downloading torrent from ' + url + '\n' + err.message)
+ process.exit(1)
+ })
+}
+
if (/^magnet:/.test(url)) {
onTorrent(url)
} else {