website_worth 0.3.9
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.
- checksums.yaml +7 -0
- data/bin/website_worth +11 -0
- data/config/environment.rb +13 -0
- data/lib/website_worth.rb +6 -0
- data/lib/website_worth/cli.rb +75 -0
- data/lib/website_worth/scraper.rb +94 -0
- data/lib/website_worth/user.rb +28 -0
- data/lib/website_worth/version.rb +3 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2f597ed2f1853bec9184dc6715f44facefa7559ab17421aaa00ad43ae72e9d65
|
4
|
+
data.tar.gz: '04366479a5f1fafdabf34e5fe74015456bbe5513366e8cb42b3c0b719b713495'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1d8ea134e1d60c7ef3b79b32d06c725bb8df3688b5663c52878a43e3fe4cda58a7924c519f048c55be5d36991205407706e11afddcc511517de5a6ba80f4a75c
|
7
|
+
data.tar.gz: 1b12248fdff71dc048b941853a96b2d715e278cfc1f20f7dd5d5c629d9d6b9eb32b0ae0fe96a4a231d3f046fbb5412918d091f85430520171e7e2161623a7579
|
data/bin/website_worth
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# LIBRARIES
|
2
|
+
|
3
|
+
require "nokogiri"
|
4
|
+
require "open-uri"
|
5
|
+
require "pry"
|
6
|
+
require "csv"
|
7
|
+
|
8
|
+
# MAIN ENVIRONMENT FILES
|
9
|
+
|
10
|
+
require_relative "../lib/website_worth/version"
|
11
|
+
require_relative "../lib/website_worth/scraper"
|
12
|
+
require_relative "../lib/website_worth/user"
|
13
|
+
require_relative "../lib/website_worth/cli"
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'csv'
|
2
|
+
class WebsiteWorth::CLI
|
3
|
+
|
4
|
+
# MAIN METHOD
|
5
|
+
def call
|
6
|
+
list_users_site_info
|
7
|
+
another?
|
8
|
+
end
|
9
|
+
|
10
|
+
# Priority Methods
|
11
|
+
|
12
|
+
def intro
|
13
|
+
time = Time.now
|
14
|
+
print "\nPlease enter your name: "
|
15
|
+
name = gets.chomp
|
16
|
+
puts "\nHello, #{WebsiteWorth::User.new(name).name}. Welcome to the Website Worth checker."
|
17
|
+
puts "\nBelow is a very short list of some of the most popular websites along with their estimated revenue and traffic data as of #{get_date_and_time}, Take a look!"
|
18
|
+
puts "=========================================================="
|
19
|
+
puts
|
20
|
+
end
|
21
|
+
|
22
|
+
def shows_big_name_data
|
23
|
+
scraper_object = WebsiteWorth::Scraper.new
|
24
|
+
revenue_data = scraper_object.gets_big_name_data
|
25
|
+
# binding.pry
|
26
|
+
puts "Google > #{revenue_data[0]}"
|
27
|
+
puts "Amazon > #{revenue_data[1]}"
|
28
|
+
puts "Facebook > #{revenue_data[2]}"
|
29
|
+
puts "Youtube > #{revenue_data[3]}"
|
30
|
+
puts
|
31
|
+
end
|
32
|
+
|
33
|
+
# WILLIS
|
34
|
+
|
35
|
+
def list_users_site_info
|
36
|
+
print "\nEnter the website that you're interested in > (eg. google.com, repl.it, yoursite.net): "
|
37
|
+
scraper_object = WebsiteWorth::Scraper.new
|
38
|
+
scraper_object.get_user_site_data
|
39
|
+
# WebsiteWorth::Scraper.prep_for_csv
|
40
|
+
end
|
41
|
+
|
42
|
+
def another?
|
43
|
+
yes_no = nil
|
44
|
+
while yes_no != 'n'
|
45
|
+
print "\nWould you like to try another site?(y/n) or (Ctrl+C[Windows Users] or Control+C[Mac Users]) to exit: "
|
46
|
+
yes_no = gets.chomp.to_s.downcase
|
47
|
+
if yes_no == "y"
|
48
|
+
list_users_site_info
|
49
|
+
elsif yes_no != 'y' || yes_no != 'n'
|
50
|
+
next
|
51
|
+
elsif yes_no == ""
|
52
|
+
next
|
53
|
+
else
|
54
|
+
exit!
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Supplement Methods
|
60
|
+
|
61
|
+
def get_date_and_time
|
62
|
+
time = Time.now
|
63
|
+
months = ["January", "February", "March", "April", "May", "June", "July", "August","September", "October", "November","December"]
|
64
|
+
days = ["Sunday", "Monday", "Tuesday", "Wednesday" ,"Thursday", "Friday", "Saturday"]
|
65
|
+
"#{days[time.wday]}, #{months[time.month - 1]} #{time.day}, #{time.year}."
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
@@ -0,0 +1,94 @@
|
|
1
|
+
class WebsiteWorth::Scraper
|
2
|
+
|
3
|
+
#attributes
|
4
|
+
attr_accessor :site_name, :overall_revenue, :rev_daily, :rev_monthly, :rev_yearly, :visits_daily, :visits_monthly, :visits_yearly, :views_daily, :views_monthly, :views_yearly, :alexa_rank, :attri
|
5
|
+
|
6
|
+
# Priority Methods
|
7
|
+
|
8
|
+
def gets_big_name_data
|
9
|
+
urls = ["https://www.worthofweb.com/website-value/google/", "https://www.worthofweb.com/website-value/amazon/", "https://www.worthofweb.com/website-value/facebook/", "https://www.worthofweb.com/website-value/youtube/"]
|
10
|
+
worth = []
|
11
|
+
urls.each do |url|
|
12
|
+
worth << Nokogiri::HTML(open(url)).css('div.card-body div.side-left p:nth-of-type(2)')[0].text
|
13
|
+
end
|
14
|
+
worth
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_user_site_data
|
18
|
+
get_data_source
|
19
|
+
pin_point_data
|
20
|
+
print_data
|
21
|
+
get_site_attributes
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_data_source
|
25
|
+
@site_name = WebsiteWorth::User.gives_a_site_name
|
26
|
+
@site = Nokogiri::HTML(open("https://www.worthofweb.com/website-value/#{site_name}/"))
|
27
|
+
end
|
28
|
+
|
29
|
+
def pin_point_data
|
30
|
+
# ========== Revenue ========== #
|
31
|
+
begin
|
32
|
+
@overall_revenue = @site.css('div.card-body div.side-left p:nth-of-type(2)')[0].text
|
33
|
+
rescue NoMethodError
|
34
|
+
puts "Sorry, it seems that the website you entered was invalid"
|
35
|
+
WebsiteWorth::CLI.new.call
|
36
|
+
end
|
37
|
+
@rev_daily = @site.css('div.card-body .col-md-4 p:nth-of-type(2)')[0].text
|
38
|
+
@rev_monthly = @site.css('div.card-body .col-md-4 p:nth-of-type(2)')[1].text
|
39
|
+
@rev_yearly = @site.css('div.card-body .col-md-4 p:nth-of-type(2)')[2].text
|
40
|
+
# ========== Visits ========== #
|
41
|
+
@visits_daily = @site.css('div.card-body .col-md-4 p:nth-of-type(2)')[3].text
|
42
|
+
@visits_monthly = @site.css('div.card-body .col-md-4 p:nth-of-type(2)')[5].text
|
43
|
+
@visits_yearly = @site.css('div.card-body .col-md-4 p:nth-of-type(2)')[7].text
|
44
|
+
# ========== Page Views ========== #
|
45
|
+
@views_daily = @site.css('div.card-body .col-md-4 p:nth-of-type(2)')[4].text
|
46
|
+
@views_monthly = @site.css('div.card-body .col-md-4 p:nth-of-type(2)')[6].text
|
47
|
+
@views_yearly = @site.css('div.card-body .col-md-4 p:nth-of-type(2)')[8].text
|
48
|
+
# ========== Alexa Rank ========== #
|
49
|
+
@alexa_rank = @site.css('div.row')[25].text.gsub(/\R+/, ' ').strip.split[9]
|
50
|
+
end
|
51
|
+
|
52
|
+
def print_data
|
53
|
+
puts "\n #{@site_name.upcase}"
|
54
|
+
get_site_attributes << @site_name.upcase
|
55
|
+
puts
|
56
|
+
puts "========== REVENUE =========="
|
57
|
+
puts
|
58
|
+
puts "===== Overall/ #{@overall_revenue} ====="
|
59
|
+
get_site_attributes << @overall_revenue
|
60
|
+
puts "===== Daily/ #{@rev_daily} ====="
|
61
|
+
get_site_attributes << @rev_daily
|
62
|
+
puts "===== Monthly/ #{@rev_monthly} ====="
|
63
|
+
get_site_attributes << @rev_monthly
|
64
|
+
puts "===== Yearly/ #{@rev_yearly} ====="
|
65
|
+
get_site_attributes << @rev_yearly
|
66
|
+
puts
|
67
|
+
puts "========== VISITS =========="
|
68
|
+
puts
|
69
|
+
puts "===== Daily/ #{@visits_daily} ====="
|
70
|
+
get_site_attributes << @visits_daily
|
71
|
+
puts "===== Monthly/ #{@visits_monthly} ====="
|
72
|
+
get_site_attributes << @visits_monthly
|
73
|
+
puts "===== Yearly/ #{@visits_yearly} ====="
|
74
|
+
get_site_attributes << @visits_yearly
|
75
|
+
puts
|
76
|
+
puts "========== PAGE VIEWS =========="
|
77
|
+
puts
|
78
|
+
puts "===== Daily/ #{@views_daily} ====="
|
79
|
+
get_site_attributes << @views_daily
|
80
|
+
puts "===== Monthly/ #{@views_monthly} ====="
|
81
|
+
get_site_attributes << @views_monthly
|
82
|
+
puts "===== Yearly/ #{@views_yearly} ====="
|
83
|
+
get_site_attributes << @views_yearly
|
84
|
+
puts
|
85
|
+
puts "========== Alexa Rank/ #{@alexa_rank} =========="
|
86
|
+
get_site_attributes << @alexa_rank
|
87
|
+
end
|
88
|
+
|
89
|
+
def get_site_attributes
|
90
|
+
@attri = []
|
91
|
+
attri
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "pry"
|
2
|
+
class WebsiteWorth::User
|
3
|
+
|
4
|
+
attr_reader :name
|
5
|
+
|
6
|
+
# responsible for providing his/her name and the necessary info to scrape
|
7
|
+
def initialize(name)
|
8
|
+
if name == ""
|
9
|
+
@name = "User"
|
10
|
+
else
|
11
|
+
@name = name[0].upcase + name[1..-1].downcase
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.gives_a_site_name
|
16
|
+
while true
|
17
|
+
user_choice = gets.chomp.downcase.to_s
|
18
|
+
if user_choice == ""
|
19
|
+
print "\nPlease enter a valid website name: "
|
20
|
+
next
|
21
|
+
else
|
22
|
+
break
|
23
|
+
end
|
24
|
+
end
|
25
|
+
user_choice
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: website_worth
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.9
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- "'Naya Willis'"
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-10-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Get the latest estimated revenue and traffic data on any website.
|
42
|
+
email:
|
43
|
+
- "'greedybrain18@gmail.com'"
|
44
|
+
executables:
|
45
|
+
- website_worth
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- bin/website_worth
|
50
|
+
- config/environment.rb
|
51
|
+
- lib/website_worth.rb
|
52
|
+
- lib/website_worth/cli.rb
|
53
|
+
- lib/website_worth/scraper.rb
|
54
|
+
- lib/website_worth/user.rb
|
55
|
+
- lib/website_worth/version.rb
|
56
|
+
homepage: https://github.com/greedybrain/website_worth.git
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubygems_version: 3.0.3
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: Website revenue and its' traffic data at your disposal
|
79
|
+
test_files: []
|