Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Yue Cai committed Nov 4, 2016
0 parents commit c75509b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions smms.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
=begin
=end

require 'rest-client'
require 'json'


filename = ARGV[0].to_i

filePath = "/Users/caiyue/Desktop/" << "#{filename}" << ".png"
content = File.open(filePath)
response = RestClient.post 'https://sm.ms/api/upload',{smfile: content}
returnData = JSON.parse(response)

url = returnData["data"]["url"]
mdAddress = "!" << url
xml = <<EOS
<xml>
<items>
<item arg="#{mdAddress}">
<title>#{mdAddress}</title>
</item>
</items>
</xml>
EOS

puts xml

0 comments on commit c75509b

Please sign in to comment.