Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
code I use to sync my posts up with app.net versions
require "nokogiri"
require "open-uri"
data = Nokogiri::XML(open("https://alpha-api.app.net/feed/rss/users/49269/posts"))
items = data.xpath("//item//atom:link/@href", "atom" => "http://www.w3.org/2005/Atom").map(&:to_s).map {|i| i.split("/").last.to_i }.zip(data.xpath("//item//link").map(&:text))
items.each do |i|
p = Post.find(i[0])
unless p.properties.has_key?('appdotnet')
p.properties['appdotnet'] = i[1]
p.save
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment