|
|
@ -12,11 +12,16 @@ module Rzz
|
|
|
|
route do |r|
|
|
|
|
route do |r|
|
|
|
|
r.get do
|
|
|
|
r.get do
|
|
|
|
r.is "test-gym" do
|
|
|
|
r.is "test-gym" do
|
|
|
|
url = "https://elemental.medium.com/feed/"
|
|
|
|
url = "https://elemental.medium.com/feed"
|
|
|
|
xml = URI.open(url).read
|
|
|
|
xml = URI.open(url).read
|
|
|
|
r.etag Digest::SHA1.hexdigest(xml)
|
|
|
|
r.etag Digest::SHA1.hexdigest(xml)
|
|
|
|
|
|
|
|
|
|
|
|
doc = Nokogiri::XML(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
|
|
|
|
doc
|
|
|
|
.xpath("/rss/channel/item")
|
|
|
|
.xpath("/rss/channel/item")
|
|
|
|
.select {|item| item.xpath("./category[text()='test-gym']").empty? }
|
|
|
|
.select {|item| item.xpath("./category[text()='test-gym']").empty? }
|
|
|
@ -39,6 +44,10 @@ module Rzz
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if __FILE__ == $0
|
|
|
|
if __FILE__ == $0
|
|
|
|
|
|
|
|
url = "https://elemental.medium.com/feed"
|
|
|
|
|
|
|
|
xml = URI.open(url).read
|
|
|
|
|
|
|
|
doc = Nokogiri::XML(xml)
|
|
|
|
|
|
|
|
|
|
|
|
require "pry"
|
|
|
|
require "pry"
|
|
|
|
binding.pry
|
|
|
|
binding.pry
|
|
|
|
end
|
|
|
|
end
|
|
|
|