Skip to content

Instantly share code, notes, and snippets.

@kazuph
Last active November 24, 2015 03:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuph/9263163 to your computer and use it in GitHub Desktop.
Save kazuph/9263163 to your computer and use it in GitHub Desktop.
Backlog記法で書かれたWikiをMarkdownのプロジェクトのWikiに全面自動移行するスクリプト ref: http://qiita.com/kazuph/items/57103dde7f4e4a0c4ff1
# Created by https://www.gitignore.io/api/vim,ruby
### Vim ###
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~
### Ruby ###
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/
## Specific to RubyMotion:
.dat*
.repl_history
build/
## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/
## Environment normalisation:
/.bundle/
/vendor/bundle
/lib/bundler/man/
# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
source "https://rubygems.org"
gem "mechanize"
gem 'pandoc-ruby'
gem "awesome_print"
gem "pry"
GEM
remote: https://rubygems.org/
specs:
awesome_print (1.6.1)
coderay (1.1.0)
domain_name (0.5.24)
unf (>= 0.0.5, < 1.0.0)
http-cookie (1.0.2)
domain_name (~> 0.5)
mechanize (2.7.3)
domain_name (~> 0.5, >= 0.5.1)
http-cookie (~> 1.0)
mime-types (~> 2.0)
net-http-digest_auth (~> 1.1, >= 1.1.1)
net-http-persistent (~> 2.5, >= 2.5.2)
nokogiri (~> 1.4)
ntlm-http (~> 0.1, >= 0.1.1)
webrobots (>= 0.0.9, < 0.2)
method_source (0.8.2)
mime-types (2.6.1)
mini_portile (0.6.2)
net-http-digest_auth (1.4)
net-http-persistent (2.9.4)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
ntlm-http (0.1.1)
pandoc-ruby (1.0.0)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
slop (3.6.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
webrobots (0.1.1)
PLATFORMS
ruby
DEPENDENCIES
awesome_print
mechanize
pandoc-ruby
pry
BUNDLED WITH
1.10.5
#!/usr/bin/env ruby
# coding : utf-8
require 'open-uri'
require "mechanize"
require "awesome_print"
require "pry"
class YapcMyArticleSearcher
def initialize(url)
@url = url
@agent = Mechanize.new
@agent.user_agent_alias = "Mac Safari"
@agent.max_history = 1
end
def blog_links
@agent.get(@url).links
end
def blog_list
blog_links.each{|link|
next if link.href =~ /http:\/\/b.hatena.ne.jp\/entry/
text = Nokogiri::HTML.parse(@agent.get(link.href).body).text
if (text =~ /(Web由来)/)
# if (text =~ /文系プログラマ/)
puts link.text
puts link.href
`open #{link.href}`
end
}
rescue => e
puts "読み込めなかった?"
end
end
if __FILE__ == $0
y = YapcMyArticleSearcher.new("http://yapcasia.org/2015/news/08/yapcasia-tokyo-2015-blog-entries.html")
ap y.blog_list
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment