cinch-title 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.rdoc +1 -0
- data/lib/cinch/plugins/title.rb +5 -2
- metadata +3 -3
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -28,6 +28,7 @@ A plugin for the Cinch ircbot framework to output HTML-titles for URL:s posted t
|
|
28
28
|
=== Options
|
29
29
|
|
30
30
|
ignore: a list of regexps of URI:S that should be ignored
|
31
|
+
max_redirects: redirects until a non-redirect is found if not set, or set it to the max number of redirects you want the plugin to follow
|
31
32
|
|
32
33
|
== Copyright
|
33
34
|
|
data/lib/cinch/plugins/title.rb
CHANGED
@@ -33,8 +33,11 @@ module Cinch
|
|
33
33
|
private
|
34
34
|
|
35
35
|
def parse uri
|
36
|
-
|
37
|
-
|
36
|
+
call = Curl::Easy.perform(uri) do |easy|
|
37
|
+
easy.follow_location = true
|
38
|
+
easy.max_redirects = config["max_redirects"]
|
39
|
+
end
|
40
|
+
html = Nokogiri::HTML(call.body_str)
|
38
41
|
title = html.xpath('//title').first
|
39
42
|
|
40
43
|
return "No title" if title.nil?
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Victor Berg\xC3\xB6\xC3\xB6"
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-02-25 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|