41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/ruboty/handlers/ymcrawl.rb', line 41
def crawl(message)
puts "crawl start in handlers"
url = (message[:url] == nil) ? "-- please set url --" : message[:url]
begin
crawl = CrawlManager.instance.get_crawl
uploader = crawl.get_uploader
if not uploader.access_token? and uploader.get_name != "local"
message.reply( get_access_token_message( uploader.get_access_token_url ) )
return nil
end
message.reply("rubot is crawling from #{url}")
zip_paths = crawl.start([url])
message.reply("get zip file => #{zip_paths}")
rescue URI::InvalidURIError => ex
puts ex
message.reply("URL is invalid. please retry.")
rescue => ex
puts "error raise in Crawl.crawl"
puts ex
message.reply("Sorry, error occurred.")
message.reply("Please feedback this error to [email protected]")
message.reply(ex)
end
end
|