Hi all,
I have created a ruby script which scraps the video url from a
website I want to implement it in rails I tried to implement it but I
am unable to implement it it shows [[undefined method `save' for
[]:Array]].......


Here is my controller code

class DevourController < ApplicationController
require 'net/http'
require 'open-uri'
def index
source =[]
array = Array.new
for path in 1..2
puts "Currently Executing Page No:----#{path}"
source = Net::HTTP.get('devour.com',"/#{path}")
html_tags=source.scan(/https?:[^"]*|http?:[^']*/)
#html_tags.gsub(/['"]/)
#puts html_tags
videos=[]
html_tags.each do |links|
videos << links if links.include?("/video/")
end
videos.uniq!
#puts videos.size
l=[]
videos.each do |y|
l << y.chomp('/')
array << l
end
puts l
puts "Successfully Executed"
end
array.uniq!
#puts l
puts array
puts array.size
puts "**********************************"
#Executing The Links To Get The Video Links
@original =[]
array.each do |f|
f.each do |url|
puts url.class
puts url
uri=URI(url)
@original << Net::HTTP.get(uri)
end
end
puts @original
puts @original.size
end

def create
@original=Link.all
@original.save
end

end

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedDec 21, '11 at 5:37a
activeDec 21, '11 at 5:52a
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Surya: 1 post MUMU: 1 post

People

Translate

site design / logo © 2021 Grokbase