rename script

Signed-off-by: Liu Lantao <liulantao@gmail.com>
This commit is contained in:
Liu Lantao 2017-11-20 07:08:09 +08:00
parent 4a3454b06b
commit 8591b37eb9
No known key found for this signature in database
GPG Key ID: BF35AA0CD375679D
2 changed files with 3 additions and 3 deletions

View File

@ -1,11 +1,11 @@
#!/bin/bash
curl 'https://developer.apple.com/search/search_data.php?q=swift%203&results=500' -s -e developer.apple.com -o search_result.json
curl 'https://developer.apple.com/search/search_data.php?q=swift%203&results=500' -s -e developer.apple.com -o /tmp/search_result.json
ruby -e "require 'json';
require 'csv';
CSV.open('samplecode.csv', 'wb') do |csv|
JSON.parse(File.open('search_result.json').read)['results'].keep_if {|v|
CSV.open('_projects.csv', 'wb') do |csv|
JSON.parse(File.open('/tmp/search_result.json').read)['results'].keep_if {|v|
v['type'] == 'sample_code'
}.sort_by {|x| x['title']}.each{|sc|
csv << [sc['url'].match('\/samplecode\/([^\/]*)\/')[1], 'https://developer.apple.com' + sc['url'] + 'Introduction/Intro.html', sc['title']]