编写网络爬虫模板

Writing web crawler templates

我需要抓取很多不同的网页来获取一些数据/我能想到的最好的解决方案是为每个主页编写一个模板,这是否可行或者是否有更好的解决方案?

我不知道这是否是最好的解决方案,但我设法让它与 eval

一起工作
template = File.expand_path("../crawlers/#{@festival.name}.rb", __FILE__)  

if File.exist?(template)
    file = File.read(template)
    results = eval(file)
end

results