Skip to content

Instantly share code, notes, and snippets.

@dzfl
Created August 6, 2014 12:37
Show Gist options
  • Save dzfl/9487fd85e2e0fa11a446 to your computer and use it in GitHub Desktop.
Save dzfl/9487fd85e2e0fa11a446 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'date'
require 'sdbm'
url = ARGV[0]
today = Date::today.to_s
dbm = SDBM.new('/path/to/xvideos.db')
unless dbm.key? url
puts `/path/to/youtube-dl -c -o "/path/to/#{Time.now.strftime('%Y%m%d%H%C')}-%(id)s-%(title)s.%(ext)s" #{url}`
dbm[url] = 'downloaded'
else
puts "pass: #{url}"
end
#cron
# * * * * * ruby /path/to/all.rb | xargs -r -P 7 -t -n 1 ruby /path/to/fetch.rb >/dev/null 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment