Setup Steps:
- Install this extension first: Referer Manager
- Add the following settings
- Install the UserScript below using TamperMonkey
- Now the webpage should show a button to view the private video like so
- Done!
// ==UserScript== | |
// @name Private Vimeo | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Script to redirect user to the private video | |
// @author You | |
// @match https://vimeo.com/* | |
// @match https://player.vimeo.com/video/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=vimeo.com | |
// @grant GM_addStyle | |
// ==/UserScript== | |
(function () { | |
"use strict"; | |
function fetchLink() { | |
let match = /(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:[a-zA-Z0-9_\-]+)?/i.exec(window.location.href); | |
if (match) { | |
return "https://player.vimeo.com/video/" + match[1]; | |
} | |
return window.location.href; | |
} | |
function ButtonClickAction(zEvent) { | |
let targetLink = fetchLink(); | |
window.open(targetLink); | |
} | |
function createButton() { | |
var zNode = document.createElement("div"); | |
zNode.innerHTML = | |
'<button id="private-button" type="button" class="iris_btn iris_btn--primary">' + | |
"View Private Video</button>"; | |
zNode.setAttribute("id", "button-container"); | |
document.querySelector(".exception_container").appendChild(zNode); | |
document | |
.getElementById("private-button") | |
.addEventListener("click", ButtonClickAction, false); | |
} | |
function init() { | |
// For the base vimeo page | |
if ( | |
document.querySelector(".exception_container") && | |
!(window.location.href.indexOf("player") > -1) | |
) { | |
createButton(); | |
} else { | |
// For the player page, change referrer | |
if ( | |
document.querySelector("h1") && | |
document.querySelector("h1").innerHTML === "Sorry" | |
) { | |
} | |
} | |
} | |
// if the window is loaded, run init(), otherwise wait for it to load | |
if (document.readyState === "complete") { | |
init(); | |
} else { | |
window.addEventListener("load", init, false); | |
} | |
})(); | |
//--- Style our newly added elements using CSS. | |
GM_addStyle(` | |
#button-container { | |
margin-top: 20px; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
} | |
#private-button { | |
cursor: pointer; | |
text-align: center; | |
display: inline-block; | |
} | |
`); |
Setup Steps: