facebook-profile-scraper 1.0.0

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. checksums.yaml +7 -0
  2. data/lib/facebook-profile-scraper.rb +49 -0
  3. metadata +44 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d7e82f7f41f06d55b3e447d08b5267b2595b2410
4
+ data.tar.gz: 3f7f6035148a901c58ee591567c49c9b10fd891b
5
+ SHA512:
6
+ metadata.gz: b34fa4b91d630a9dfed4ba656bdbb0429c881688e7f9d02c089eb7dfbcc1beb6aff1119a0ff66879f769c1f7c3939c4434f9372247856e21da9417958e7f7e52
7
+ data.tar.gz: 3853965b615342d34041a7826b0e224c77f2e31056e08b0053ba43df169d5c47886d937238455232efb7946a32aa618f5e3189d376716b9f92a4afdd680488d9
@@ -0,0 +1,49 @@
1
+ require 'HTTParty'
2
+ require 'Nokogiri'
3
+
4
+ class FacebookProfileScraper
5
+ def initialize(facebook_profile)
6
+ begin
7
+ # Download page (GET REQEUST)
8
+ @page = HTTParty.get(facebook_profile)
9
+ # Parse the page with Nokogiri
10
+ @parsed_page = Nokogiri::HTML(@page)
11
+ rescue
12
+ end
13
+ end
14
+ def name
15
+ begin
16
+ # Parse full name from profile
17
+ @parsed_page.css('#fb-timeline-cover-name').text
18
+ rescue
19
+ end
20
+ end
21
+ def picture
22
+ begin
23
+ # Parse profile picture from profile
24
+ @parsed_page.css('img.profilePic.img').attr('src')
25
+ rescue
26
+ end
27
+ end
28
+ def city
29
+ begin
30
+ # Parse first city from profile
31
+ @parsed_page.css('#pagelet_hometown span._50f5._50f7')[0].css('a').text
32
+ rescue
33
+ end
34
+ end
35
+ def about
36
+ begin
37
+ # Parse "about" from profile
38
+ @parsed_page.css('#pagelet_bio span._c24._50f4')[0].text
39
+ rescue
40
+ end
41
+ end
42
+ def quote
43
+ begin
44
+ # Parse "quote" from profile
45
+ @parsed_page.css('#pagelet_quotes span._c24._50f4')[0].text
46
+ rescue
47
+ end
48
+ end
49
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: facebook-profile-scraper
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Rasmus Kjellberg
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-08-24 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Parses info from Facebook profiles
14
+ email: rk@youngmedia.se
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/facebook-profile-scraper.rb
20
+ homepage: https://github.com/kjellberg/facebook-profile-scraper
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.5.1
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Parses info from Facebook profiles
44
+ test_files: []