Created
December 25, 2017 08:29
-
-
Save sonsongithub/42411b38d895ce60a2bb09fb40af7755 to your computer and use it in GitHub Desktop.
amazon_parser.rb
This file contains hidden or 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
| fr = File.open("./booklist.txt", "r") | |
| text = fr.read | |
| a = text.scan(/注文の詳細注文日: (\d+)年(\d+)月(\d+)日.+\n(.+?)\n(.+?)\n販売: (.+?)\n/) | |
| a.each{|e| | |
| title = e[3].gsub("(Kindle 書籍 Kindle Books)", "") | |
| year = e[0].to_i | |
| month = e[1].to_i | |
| day = e[2].to_i | |
| date = sprintf("%04d/%02d/%02d", year, month, day) | |
| if e[3] =~ /コミックス/ | |
| else | |
| puts "#{date} #{title}" | |
| end | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment