module Medium::Scrapper

Constants

VERSION

Public Class Methods

get(username, type) click to toggle source
# File lib/medium/scrapper.rb, line 7
def self.get(username, type)
  user = Hash.from_xml(open("https://medium.com/feed/@" + username).read)
  if type == "name"
    user["rss"]["channel"]["title"].split(" ").slice(2..-3)
  elsif type == "posts"
    user["rss"]["channel"]["item"]
  elsif type == "url"
    "https://medium.com/@" + username
  else
    "POr ahora solo se maneja NOMBRE, POSTS Y URL."
  end
end