Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- responsed = HTTParty.get('http://joeroganexp.joerogan.libsynpro.com/rss')
- response = Crack::XML.parse(responsed)
- Podcast.create(title: response["rss"]["channel"]["title"], copyright: response["rss"]["channel"]["copyright"], description: response["rss"]["channel"]["description"], docs: response["rss"]["channel"]["link"], feed_url: response["rss"]["channel"]["itunes:new_feed_url"], image_url: response["rss"]["channel"]["image"]["url"], language: response["rss"]["channel"]["language"], author: response["rss"]["channel"]["itunes:author"], explicit: response["rss"]["channel"]["itunes:explicit"])
- response["rss"]["channel"]["item"].each do |item|
- Episode.create(title: item["title"], content: item["description"], enclosure_length: item["enclosure"]["length"].to_i, enclosure_type: item["enclosure"]["type"], enclosure_url: item["enclosure"]["url"], pubdate: item["pubDate"].to_datetime, guid: item["guid"], duration: item["itunes:duration"].to_i, explicit: item["itunes:explicit"])
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement