Skip to content

Instantly share code, notes, and snippets.

@Robdel12
Last active April 18, 2016 00:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Robdel12/e77fc70800642e62867a to your computer and use it in GitHub Desktop.
Save Robdel12/e77fc70800642e62867a to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Vine download link
// @namespace http://www.robert-deluca.com
// @version 0.1
// @description Download a vine video
// @author Robert DeLuca
// @match https://vine.co/*
// @grant none
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// ==/UserScript==
function addVideoURLToSingleVideo() {
var s = $('.main .vine-video-container video').attr('poster');
var videoURL = s.substring(0, s.indexOf('.jpg'));
var constructedLink = '<a href="' + videoURL + '" class="custom-vine-dl-link" style="display: block; margin-top: 10px"">Download Video</a>';
$('.post-social-metrics').append(constructedLink);
}
waitForKeyElements (".main", addVideoURLToSingleVideo);
function addVideoURLToMulti() {
if($('.post').hasClass('ember-view')) {
var s = $('.vine-video-container video').attr('poster');
var videoURL = s.substring(0, s.indexOf('.jpg'));
var postActionsBtn = '<a href="' + videoURL + '"><button class="ember-view action clear share custom-vine-dl-link"><span style="transform: rotate(180deg);" class="icon-share_stroked"></span><span class="icon-share_stroked"></span><span class="caption">Download Video</span></button></a>'
$('.post-actions').append(postActionsBtn);
$('.post').removeClass('ember-view');
}
}
waitForKeyElements (".post", addVideoURLToMulti);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment