I keep getting this error. I'm very confused. This is when I try and scrape a website.
Error: no implicit conversion of Symbol into Integer
Here is the scraper class
class RestaurantsScraper < Kimurai::Base
@name = "restaurants_scraper"
@driver = :selenium_chrome
@start_urls = ["https://www.tripadvisor.com/Restaurants-g31892-Rogers_Arkansas.html"]
def parse(response, url:, data: {})
response.xpath("//div[@class=_1llCuDZj]").each do |a|
request_to :parse_repo_page, url: absolute_url(a[:href], base: url)
end
end
def parse_repo_page(response, url:, data: {})
item = {}
item["title"] = t.css('a._15_ydu6b')&.text&.squish&.gsub('[^0-9].', '')
item["type"] = t.css('span._1p0FLy4t')&.text&.squish
item["reviews"] = t.css('span.w726Ki5B').text&.squish
item["top_reviews"] = t.css('a._2uEVo25r _3mPt7dFq').text&.squish
Restaurant.where(item).first_or_create
byebug
end
end
Here is my /scrape in my controller page
url = "https://www.tripadvisor.com/Restaurants-g31892-Rogers_Arkansas.html"
response = RestaurantsScraper.parse!(:parse, url: "https://www.tripadvisor.com/Restaurants-g31892-Rogers_Arkansas.html")
if response[:status] == :completed && response[:error].nil?
flash.now[:notice] = "Successfully scraped url"
else
flash.now[:alert] = response[:error]
end
rescue StandardError => e
flash.now[:alert] = "Error: #{e}"
end
Here is the error
question from:
https://stackoverflow.com/questions/65921406/error-no-implicit-conversion-of-symbol-into-integer 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…