Created
December 28, 2021 16:45
-
-
Save jamespearson/3c3fe9bf6083730c9d42c23347150a9e to your computer and use it in GitHub Desktop.
Xbox Clip Downloader
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
require 'open-uri' | |
require 'nokogiri' | |
require 'net/http' | |
def _get(url:, raw: false) | |
res = Net::HTTP.get_response(URI(url)) | |
raw ? res : Nokogiri::HTML(res.body.to_s) | |
end | |
page = _get(url: "https://xboxclips.co/mansizedrooster") | |
download_urls = page.css('a.download').map{ |d| d.attr('href') } | |
download_urls.each_with_index do |download_url, index| | |
download_page = _get(url: download_url) | |
video_url = download_page.css('.video-button a').first.attr('href') | |
download = open(video_url) | |
IO.copy_stream(download, "/Users/jamespearson/Downloads/#{index}.mp4") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment