Created
December 31, 2014 23:51
-
-
Save bouchard/d98b610caf95a4c8e217 to your computer and use it in GitHub Desktop.
Download Private but Embedded Vimeo Videos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'nokogiri' | |
require 'net/http' | |
require 'shellwords' | |
require 'json' | |
source = Net::HTTP.get('www.domain.com', '/thepagethathasthevideos/') | |
doc = Nokogiri::HTML(source) | |
ids = doc.css('a').map{ |a| a.attr('data-vimeoid') }.compact.uniq | |
ids.each_with_index do |id, i| | |
puts "Downloading #{i + 1}: #{id}" | |
request = `curl 'http://player.vimeo.com/video/#{id}?api=1&player_id=video#{id}&title=0&byline=0&portrait=0' -H 'Pragma: no-cache' -H 'DNT: 1' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: http://www.artofthetitle.com/feature/top-10-title-sequences-of-2014/' -H 'Connection: keep-alive' -H 'Cache-Control: no-cache' --compressed` | |
beginning_string = %|h=!1,k=!1,a=| | |
end_string = %|;if(a.request)if("object"| | |
json = JSON.parse(request.split(beginning_string)[1].split(end_string)[0]) | |
url = json['request']['files']['h264']['hd']['url'] | |
title = json['video']['title'] | |
t = [ | |
%|curl #{Shellwords.escape(url)} >> #{Shellwords.escape(title)}.mp4| | |
].join(' && ') | |
`#{t}` | |
end |
+1
thanks! it's work. but in curl need change Referer. Write your site, where the private video is located. 'Referer: https://github.com' for example. I didn't use script, I execute curl (with my videoId and referer) and get urls for download from the response
I tried this but it isn't working for me.
This actually works -> https://github.com/Tusko/vimeo-private-downloader
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, does this still work? If it does, can you give me an usage example? Thanks