|
|
|
@ -12,11 +12,16 @@ module Rzz
|
|
|
|
|
route do |r|
|
|
|
|
|
r.get do
|
|
|
|
|
r.is "test-gym" do
|
|
|
|
|
url = "https://elemental.medium.com/feed/"
|
|
|
|
|
url = "https://elemental.medium.com/feed"
|
|
|
|
|
xml = URI.open(url).read
|
|
|
|
|
r.etag Digest::SHA1.hexdigest(xml)
|
|
|
|
|
|
|
|
|
|
doc = Nokogiri::XML(xml)
|
|
|
|
|
|
|
|
|
|
self_url = "#{r.base_url}#{r.path}" # Should this be configured via the environment?
|
|
|
|
|
doc.at_xpath("/rss/channel/link/text()").content = self_url
|
|
|
|
|
doc.at_xpath("/rss/channel/atom:link[@href='#{url}']")["href"] = self_url
|
|
|
|
|
|
|
|
|
|
doc
|
|
|
|
|
.xpath("/rss/channel/item")
|
|
|
|
|
.select {|item| item.xpath("./category[text()='test-gym']").empty? }
|
|
|
|
@ -39,6 +44,10 @@ module Rzz
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if __FILE__ == $0
|
|
|
|
|
url = "https://elemental.medium.com/feed"
|
|
|
|
|
xml = URI.open(url).read
|
|
|
|
|
doc = Nokogiri::XML(xml)
|
|
|
|
|
|
|
|
|
|
require "pry"
|
|
|
|
|
binding.pry
|
|
|
|
|
end
|
|
|
|
|