cinch-title 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Victor Bergöö
1
+ Copyright (c) 2010-2011 Victor Bergöö
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
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
 
@@ -33,8 +33,11 @@ module Cinch
33
33
  private
34
34
 
35
35
  def parse uri
36
- content = Curl::Easy.perform(uri).body_str
37
- html = Nokogiri::HTML(content)
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
- - 0
9
- version: 0.2.0
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-01-30 00:00:00 +01:00
17
+ date: 2011-02-25 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency