aboutsummaryrefslogtreecommitdiffstats
path: root/stella.js
diff options
context:
space:
mode:
authoranekos2011-05-01 00:17:41 +0900
committeranekos2011-05-01 00:17:41 +0900
commitc3cf4a117499bed69961bfd5e731e0350f4c62cd (patch)
treee6d099694618cf57333fe212c8f2b962f41ab4f8 /stella.js
parent018875aa55263ab9ee3b39075e24136d3177c68e (diff)
downloadvimperator-plugins-c3cf4a117499bed69961bfd5e731e0350f4c62cd.tar.bz2
Fetch on vimeo.
Thanks, eagletmt. https://gist.github.com/949731
Diffstat (limited to 'stella.js')
-rw-r--r--stella.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/stella.js b/stella.js
index c0719a2..c6b87a0 100644
--- a/stella.js
+++ b/stella.js
@@ -1478,6 +1478,7 @@ Thanks:
functions: {
currentTime: 'w',
+ fetch: 'x',
makeURL: 'x',
muted: 'w',
pause: 'x',
@@ -1527,6 +1528,25 @@ Thanks:
get volume () parseInt(this.player.__stella_volume),
set volume (value) (this.api_setVolume(value), this.player.__stella_volume = value),
+ fetch: function(filepath) {
+ let self = this;
+ let id = U.currentURL.match(/vimeo\.com\/(\d+)/)[1];
+ U.httpRequest(
+ 'http://www.vimeo.com/moogaloop/load/clip:' + id,
+ null,
+ function(xhr) {
+ let doc = xhr.responseXML;
+ let signature = U.xpathGet('/xml/request_signature', doc).textContent;
+ let timestamp = U.xpathGet('/xml/timestamp', doc).textContent;
+ let isHD = parseInt(U.xpathGet('/xml/video/isHD', doc).textContent);
+ let url = 'http://www.vimeo.com/moogaloop/play/clip:' + id
+ + '/' + signature + '/' + timestamp
+ + '/?q=' + (isHD ? 'hd' : 'sd');
+ U.download(url, filepath, isHD ? '.mp4' : '.flv', self.title);
+ }
+ );
+ },
+
makeURL: function (value, type) {
switch (type) {
case Player.URL_ID: