Skip to content

Instantly share code, notes, and snippets.

@ssig33
Created July 5, 2014 06:41
Show Gist options
  • Save ssig33/11757d0d45048a378869 to your computer and use it in GitHub Desktop.
Save ssig33/11757d0d45048a378869 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'rss'
require 'open-uri'
require 'uri'
# 日本人っぽいのだけ欲しい場合'
URL = 'http://xpathfeed.com/feed?url=http%3A%2F%2Fjp.xvideos.com%2F&xpath_list=%2F%2F*%5B%40class%3D%22thumbBlock%22%5D%2Fdiv%2Fp%5B1%5D%2Fa'
RSS::Parser.parse(open(URL).read).channel.items.each{|x|
uri = URI.parse x.link
uri.host ='www.xvideos.com'
puts uri.to_s
}
@ssig33
Copy link
Author

ssig33 commented Jul 5, 2014

usage: ruby all.rb | xargs youtube-dl

ダウンロードしたかどうか管理したい場合は xargs の先で実行するコマンドをダウンロードしたかどうか判断してから youtube-dl 起動するラッパーとかにすればいいんじゃないでしょうか。

@ssig33
Copy link
Author

ssig33 commented Jul 5, 2014

ラッパーこういうの。

#!/usr/bin/env ruby
require 'dbm'

url = ARGV[0]

dbm = DBM.new('xvideos.db')

unless dbm[url]
  system 'youtube-dl', url
  dbm[url] = 'downloaded'
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment