social_scraper 0.0.1 → 0.0.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.
- data/lib/social_scraper/scraper.rb +30 -0
- data/lib/social_scraper/version.rb +1 -1
- data/lib/social_scraper.rb +7 -7
- metadata +7 -6
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'nokogiri'
|
4
|
+
|
5
|
+
module SocialScraper
|
6
|
+
class Scraper
|
7
|
+
attr_reader :url
|
8
|
+
|
9
|
+
def initialize(url)
|
10
|
+
@url = URI.parse(url).scheme.nil? ? 'http://' + url : url
|
11
|
+
puts "URL IS: #{@url}"
|
12
|
+
# @data = Hashie::Rash.new('url' => @url)
|
13
|
+
|
14
|
+
|
15
|
+
# doc = Nokogiri::HTML(open(@url))
|
16
|
+
#
|
17
|
+
# doc.xpath('//a').each do |link|
|
18
|
+
# href = link.attributes["href"]
|
19
|
+
#
|
20
|
+
# # check for a twitter link
|
21
|
+
# if href.present? && href.value =~ /twitter/
|
22
|
+
# # assume http://twitter.com/xyz, get the account: xyz
|
23
|
+
# junk,@twitter_account = href.value.split("twitter.com/")
|
24
|
+
# end
|
25
|
+
# end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/social_scraper.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'social_scraper/scraper'))
|
2
|
+
|
1
3
|
module SocialScraper
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
4
|
+
extend self
|
5
|
+
|
6
|
+
def new(url)
|
7
|
+
Scraper.new(url)
|
6
8
|
end
|
7
|
-
end
|
8
|
-
|
9
|
-
::Object.send(:include, ::SocialScraper::ObjectExtensions) unless ::Object.method_defined?(:srape)
|
9
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_scraper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,16 +13,16 @@ date: 2011-10-17 00:00:00.000000000 -04:00
|
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
requirement: &
|
16
|
+
name: nokogiri
|
17
|
+
requirement: &2153703760 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
|
-
- -
|
20
|
+
- - ! '>='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2153703760
|
26
26
|
description: ''
|
27
27
|
email:
|
28
28
|
- adam@richminds.com
|
@@ -30,6 +30,7 @@ executables: []
|
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
|
+
- lib/social_scraper/scraper.rb
|
33
34
|
- lib/social_scraper/version.rb
|
34
35
|
- lib/social_scraper.rb
|
35
36
|
- lib/tasks/social_scraper_tasks.rake
|