Last active
April 24, 2021 22:48
-
-
Save kinduff/c2a92492b0cb0a25d423 to your computer and use it in GitHub Desktop.
[4chan WebM Downloader] #4chan
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
# | |
# 4chan Webm Downloader | |
# Fetches all webms from a thread | |
# filters out all the .webm files | |
# and downloads to a custom path | |
# using wget | |
# | |
# Requires | |
# nokogiri: gem install nokogiri | |
# | |
# Usage | |
# ruby 4chan_webm_downloader.rb URL PATH | |
# | |
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
puts "Start" | |
input_url = ARGV[0] | |
path = ARGV[1] | |
website = Nokogiri::HTML(open(input_url)) | |
links = website.css('.fileText a') | |
i = 0 | |
links.each do |link| | |
url = link['href'] | |
name = link.content | |
if File.extname(url) == ".webm" | |
`wget -nd -O "#{path}/#{name}" http:#{url}` | |
end | |
end | |
puts "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@fire-hawk-86 Updated with your change, thank you.