53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/Zeta/plugins/snooper.rb', line 53
def execute(msg, url)
url = "http://#{url}" unless url=~/^https?:\/\//
url = URI.encode(url)
p = URI(url)
return if Blacklist.urls.include? p.host
VideoInfo.provider_api_keys = { youtube: Config.secrets[:google] }
if p.host == 'youtube.com' || p.host == 'www.youtube.com' || p.host == 'youtu.be'
match_youtube(msg, url)
elsif p.host == 'i.imgur.com' || p.host == 'imgur.com'
match_imgur(msg, url)
else
match_other(msg,url)
end
rescue => e
error "#{e.class.name}: #{e.message}"
error "[404] #{msg.user} - #{url}"
end
|