comedy 0.1.1 → 0.1.2

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.
Files changed (3) hide show
  1. data/lib/comedy/version.rb +1 -1
  2. data/lib/comedy.rb +10 -3
  3. metadata +4 -4
@@ -1,3 +1,3 @@
1
1
  module Comedy
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
data/lib/comedy.rb CHANGED
@@ -1,10 +1,17 @@
1
1
  require 'launchy'
2
2
  require 'mechanize'
3
3
  module Comedy
4
- def self.laugh_with(star)
4
+ def self.search(star)
5
5
  agent = Mechanize.new
6
- page = agent.get("http://www.youtube.com/results?search_query=comedy+#{star}").links_with(:href => /watch/)
6
+ page = []
7
+ (1..5).each do |i|
8
+ page += agent.get("http://www.youtube.com/results?search_query=comedy+#{star}&page=#{i}").links_with(:href => /watch/)
9
+ end
7
10
  link = page[rand(page.length)].uri.to_s
8
- Launchy.open("http://www.youtube.com/#{link}")
11
+ return link
9
12
  end
13
+
14
+ def self.laugh_with(man)
15
+ Launchy.open("http://www.youtube.com/#{search(man)}")
16
+ end
10
17
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comedy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - anand9
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-12-19 00:00:00 +05:30
18
+ date: 2012-12-27 00:00:00 +05:30
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency