Skip to content

Instantly share code, notes, and snippets.

@jamespearson
Created December 28, 2021 16:45
Show Gist options
  • Save jamespearson/3c3fe9bf6083730c9d42c23347150a9e to your computer and use it in GitHub Desktop.
Save jamespearson/3c3fe9bf6083730c9d42c23347150a9e to your computer and use it in GitHub Desktop.
Xbox Clip Downloader
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