se_climbing_videos 0.1.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.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/NOTES.md +78 -0
- data/README.md +39 -0
- data/Rakefile +2 -0
- data/bin/console +15 -0
- data/bin/se_climbing_videos +6 -0
- data/bin/setup +8 -0
- data/config/environment.rb +9 -0
- data/end +0 -0
- data/lib/se_climbing_videos.rb +30 -0
- data/lib/se_climbing_videos/cli.rb +126 -0
- data/lib/se_climbing_videos/scraper.rb +13 -0
- data/lib/se_climbing_videos/version.rb +3 -0
- data/lib/se_climbing_videos/video.rb +47 -0
- data/se_climbing_videos.gemspec +40 -0
- data/spec.md +6 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 84ab1ae583f5fa2580468ac1d3b0e156ea7cdcf9
|
4
|
+
data.tar.gz: b900ef68b69d61ede6a9928750cf7f98525da0b2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6f0390f1f8a5da658de0ea0418a5447da21c22e6bb2e4e81d9d609fe4b364efe9f3021e7d7bc1a167fa0a9eb4c70ea73c44c67f3e2d381908db58309e784ae8c
|
7
|
+
data.tar.gz: e62f7e9edf87b641e45111f57d12ccf62162fbce0259ab88c05a438f9d882b7b9d4551964bc1eb5fcfb8af036b0ef442d1a3a83e4179b2d50423dbc455072a89
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at 'liahwallace1@gmail.com'. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 'Liah Wallace'
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/NOTES.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
How to Build a CLI Gem (from CLI Gem Walkthrough video)
|
2
|
+
|
3
|
+
1. Plan your gem, imagine your interface
|
4
|
+
2. Start with the project structure (google)
|
5
|
+
3. Start with the entry point - the file run
|
6
|
+
4. Force that to build the CLI interface
|
7
|
+
5. Stub out the interface
|
8
|
+
6. Start making things real
|
9
|
+
7. Discover Objects.
|
10
|
+
8. Program
|
11
|
+
|
12
|
+
1. A command line interface to find videos for popular Southeast Bouldering locations. App with scrape videos from vimeo and youtube.
|
13
|
+
- user types se_climbing_videos
|
14
|
+
- Prompt: Enter the number for the location you would like to search. You can select:
|
15
|
+
1. Boone, NC
|
16
|
+
2. Grayson Highlands, VA
|
17
|
+
3. Horse Pens 40, AL
|
18
|
+
4. Rocktown, GA
|
19
|
+
5. Rumbling Bald, NC
|
20
|
+
6. Stone Fort (LRC), TN
|
21
|
+
- Provides a list of videos for that area like this: (Initially sort my upload date)
|
22
|
+
1. Video name - Uploaded by - Upload date
|
23
|
+
2. Video name - Uploaded by - Upload date
|
24
|
+
- Prompt: Which video would you like more information about? Please enter the number.
|
25
|
+
- Provides user the description, length, and link to the selected video.
|
26
|
+
|
27
|
+
- Questions I still have about usability
|
28
|
+
- Should the user be allowed to sort?
|
29
|
+
- Should I limit the output to the latest 100 videos? Will I need to add a More feature?
|
30
|
+
- Should the user be able to enter a date range like last month, last year, forever?
|
31
|
+
|
32
|
+
2. You can make folders for Bundler gem by typing <bundle gem gem_name> into the terminal
|
33
|
+
- https://bundler.io/v1.13/guides/creating_gem
|
34
|
+
- http://railscasts.com/episodes/245-new-gem-with-bundler
|
35
|
+
- I created <bundle gem se_climbing_videos> with a license and Code of Conduct.
|
36
|
+
- I added a bin file, se_climbing_videos, and updated the permissions to allow this to execute with <chmod +x se_climbing_videos> and made sure it could run with "./bin/se_climbing_videos"
|
37
|
+
|
38
|
+
3. We want our CLI file (bin/se_climbing_videos) to be as simple as possible.
|
39
|
+
- first put "#!/usr/bin/env ruby" so it runs in ruby
|
40
|
+
- require our environment that connects our bin file to all of our other files.
|
41
|
+
- SeClimbingVideos::CLI.new.call
|
42
|
+
- This should be all we need to run our file. Don't want to change this file in the future - program all of this in our lib files
|
43
|
+
|
44
|
+
|
45
|
+
- - NOTE ON REQUIRING FILES:
|
46
|
+
- bin/se_climbing_videos
|
47
|
+
- require '.lib/environment'
|
48
|
+
-THEREFORE, lib/environment.rb (renamed sc_climbing_videos.rb to environment for less confusion)
|
49
|
+
- require_relative "./se_climbing_videos/version"
|
50
|
+
- require_relative "./se_climbing_videos/cli"
|
51
|
+
|
52
|
+
4. Our bin/se_climbing_videos file will now run a CLI Controller file - we need to make that.
|
53
|
+
- In the lib/se_climbing_videos folder, we create a new ruby file called cli.rb. This is where we will put all the coding for how our CLI will work. (includes things like the prompts and what will occur in the CLI that the user sees and interacts with)
|
54
|
+
|
55
|
+
5. To get our CLI Controller (cli.rb) file started, I created a class that inherits from the SeClimbingVideos class (without saying it is a type of SeClimbingVideo)
|
56
|
+
- In that class we make a call method (which is used in our bin file). To get started and make sure it works, we just say that the call method puts "SE Climbing Videos"
|
57
|
+
- we can use fake data to start listing out our methods we might want to use in the CLI
|
58
|
+
|
59
|
+
|
60
|
+
Links to search:
|
61
|
+
1. Boone, NC
|
62
|
+
- Youtube: https://www.youtube.com/results?sp=CAI%253D&q=Boone+NC+bouldering
|
63
|
+
- Vimeo: https://vimeo.com/search/sort:latest?q=Boone%2C+NC+bouldering
|
64
|
+
2. Grayson Highlands, VA
|
65
|
+
- Youtube: https://www.youtube.com/results?q=Grayson+Highlands+bouldering&sp=CAI%253D
|
66
|
+
- Vimeo: https://vimeo.com/search/sort:latest?q=Grayson+Highlands+bouldering
|
67
|
+
3. Horse Pens 40, AL
|
68
|
+
- Youtube: https://www.youtube.com/results?q=horse+pens+40+bouldering&sp=CAI%253D
|
69
|
+
- Vimeo: https://vimeo.com/search/sort:latest?q=Horse+Pens+40+bouldering
|
70
|
+
4. Rocktown, GA
|
71
|
+
- Youtube: https://www.youtube.com/results?q=Rocktown+bouldering&sp=CAI%253D
|
72
|
+
- Vimeo: https://vimeo.com/search/sort:latest?q=Rocktown+bouldering
|
73
|
+
5. Rumbling Bald, NC
|
74
|
+
- Youtube: https://www.youtube.com/results?q=rumbling+bald+bouldering&sp=CAI%253D
|
75
|
+
- Vimeo: https://vimeo.com/search/sort:latest?q=rumbling+bald+bouldering
|
76
|
+
6. Stone Fort (LRC), TN
|
77
|
+
- Youtube: https://www.youtube.com/results?sp=CAI%253D&q=Stone+Fort+LRC+bouldering
|
78
|
+
- Vimeo: https://vimeo.com/search/sort:latest?q=stone+fort+lrc+bouldering
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# SeClimbingVideos
|
2
|
+
|
3
|
+
The Southeast Climbing Videos gem will help you find the newest videos uploaded on Youtube for your favorite Southeast Bouldering spot by providing a list of videos by location and upload date. You can keep up with new videos at your favorite southeast bouldering location by checking back often!
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'se_climbing_videos'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install se_climbing_videos
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
TODO: Write usage instructions here
|
25
|
+
|
26
|
+
## Development
|
27
|
+
|
28
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
29
|
+
|
30
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/liahwallace1/se_climbing_videos. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
35
|
+
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "se_climbing_videos"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
puts "Welcome to sandbox!"
|
15
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'pry'
|
2
|
+
require 'nokogiri'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'colorize'
|
5
|
+
|
6
|
+
require_relative '../lib/se_climbing_videos/cli'
|
7
|
+
require_relative '../lib/se_climbing_videos/scraper'
|
8
|
+
require_relative '../lib/se_climbing_videos/video'
|
9
|
+
require_relative '../lib/se_climbing_videos/version'
|
data/end
ADDED
File without changes
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative '../config/environment'
|
2
|
+
|
3
|
+
module SeClimbingVideos
|
4
|
+
SEARCH_LINKS = {
|
5
|
+
"1" => {
|
6
|
+
location: "Boone, NC",
|
7
|
+
link: "https://www.youtube.com/results?sp=CAI%253D&q=Boone+NC+bouldering"
|
8
|
+
},
|
9
|
+
"2" => {
|
10
|
+
location: "Grayson Highlands, VA",
|
11
|
+
link: "https://www.youtube.com/results?q=Grayson+Highlands+bouldering&sp=CAI%253D"
|
12
|
+
},
|
13
|
+
"3" => {
|
14
|
+
location: "Horse Pens 40, AL",
|
15
|
+
link: "https://www.youtube.com/results?q=horse+pens+40+bouldering&sp=CAI%253D"
|
16
|
+
},
|
17
|
+
"4" => {
|
18
|
+
location: "Rocktown, GA",
|
19
|
+
link: "https://www.youtube.com/results?q=Rocktown+bouldering&sp=CAI%253D"
|
20
|
+
},
|
21
|
+
"5" => {
|
22
|
+
location: "Rumbling Bald, NC",
|
23
|
+
link: "https://www.youtube.com/results?q=rumbling+bald+bouldering&sp=CAI%253D"
|
24
|
+
},
|
25
|
+
"6" => {
|
26
|
+
location: "Stone Fort (LRC), TN",
|
27
|
+
link: "https://www.youtube.com/results?sp=CAI%253D&q=Stone+Fort+LRC+bouldering"
|
28
|
+
}
|
29
|
+
}
|
30
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
class SeClimbingVideos::CLI
|
2
|
+
|
3
|
+
attr_accessor :location_input
|
4
|
+
|
5
|
+
def call
|
6
|
+
puts ""
|
7
|
+
puts "Welcome to SE Climbing Videos. This is a way to find the newest videos uploaded on Youtube for your favorite Southeast Bouldering spot.".colorize(:light_cyan)
|
8
|
+
puts ""
|
9
|
+
start
|
10
|
+
end
|
11
|
+
|
12
|
+
def start
|
13
|
+
location_search
|
14
|
+
print_videos
|
15
|
+
select_video
|
16
|
+
select_new_video
|
17
|
+
select_new_location
|
18
|
+
goodbye
|
19
|
+
end
|
20
|
+
|
21
|
+
def location_search
|
22
|
+
puts "Please enter the number of the bouldering area you would like to search:".colorize(:cyan)
|
23
|
+
puts "You can enter:".colorize(:cyan)
|
24
|
+
puts "1. Boone, NC"
|
25
|
+
puts "2. Grayson Highlands, VA"
|
26
|
+
puts "3. Horse Pens 40, AL"
|
27
|
+
puts "4. Rocktown, GA"
|
28
|
+
puts "5. Rumbling Bald, NC"
|
29
|
+
puts "6. Stone Fort (LRC), TN"
|
30
|
+
self.location_input = gets.strip
|
31
|
+
|
32
|
+
if ["1", "2", "3", "4", "5", "6"].include?(@location_input)
|
33
|
+
SeClimbingVideos::Scraper.new.make_videos(SeClimbingVideos::SEARCH_LINKS[@location_input][:link], SeClimbingVideos::SEARCH_LINKS[@location_input][:location])
|
34
|
+
|
35
|
+
elsif @location_input =="exit"
|
36
|
+
goodbye
|
37
|
+
exit
|
38
|
+
else
|
39
|
+
puts "Please enter a valid number. If you don't see your favorite location, send me an email so I can update the app!".colorize(:yellow)
|
40
|
+
location_search
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def print_videos
|
45
|
+
puts "---Latest 20 videos from #{SeClimbingVideos::SEARCH_LINKS[@location_input][:location]}---".colorize(:light_blue)
|
46
|
+
puts ""
|
47
|
+
SeClimbingVideos::Video.all.each.with_index(1) do |video, i|
|
48
|
+
if video.location == SeClimbingVideos::SEARCH_LINKS[@location_input][:location]
|
49
|
+
puts "#{i}. "+"#{video.name}".colorize(:light_blue)+" - #{video.upload_user} - #{video.upload_date}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def select_video
|
55
|
+
puts ""
|
56
|
+
puts "Please select which video from the list you would like to learn more about:".colorize(:cyan)
|
57
|
+
video_input = gets.strip
|
58
|
+
|
59
|
+
if video_input.to_i > 0 and video_input.to_i < 21
|
60
|
+
video = SeClimbingVideos::Video.find(video_input)
|
61
|
+
display_video(video)
|
62
|
+
elsif video_input == "exit"
|
63
|
+
select_new_location
|
64
|
+
else
|
65
|
+
puts "Not sure which video you want to see more about. Type a number from the list or exit.".colorize(:yellow)
|
66
|
+
select_video
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def display_video(video)
|
71
|
+
puts ""
|
72
|
+
puts "Video Name:".colorize(:light_blue)+" #{video.name}"
|
73
|
+
puts ""
|
74
|
+
puts "Location:".colorize(:light_blue)+" #{video.location}"
|
75
|
+
puts "Upload Date:".colorize(:light_blue)+" #{video.upload_date}"
|
76
|
+
puts "Uploaded By:".colorize(:light_blue)+" #{video.upload_user}"
|
77
|
+
puts "Duration:".colorize(:light_blue)+" #{video.duration}"
|
78
|
+
puts "Video URL:".colorize(:light_blue)+" #{video.video_url}"
|
79
|
+
puts ""
|
80
|
+
puts "Description:".colorize(:light_blue)
|
81
|
+
puts "#{video.description}"
|
82
|
+
puts ""
|
83
|
+
end
|
84
|
+
|
85
|
+
def select_new_video
|
86
|
+
puts "Would you like to select another video from the list? (Y/N)".colorize(:cyan)
|
87
|
+
input = gets.strip.downcase
|
88
|
+
case input
|
89
|
+
when "y"
|
90
|
+
select_video
|
91
|
+
select_new_video
|
92
|
+
when "n"
|
93
|
+
select_new_location
|
94
|
+
when "exit"
|
95
|
+
goodbye
|
96
|
+
exit
|
97
|
+
else
|
98
|
+
puts "Please enter Y to search more videos or N to exit".colorize(:yellow)
|
99
|
+
select_new_video
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def select_new_location
|
104
|
+
puts "Would you like to search for videos in a different location? (Y/N)".colorize(:cyan)
|
105
|
+
input = gets.strip.downcase
|
106
|
+
case input
|
107
|
+
when "y"
|
108
|
+
SeClimbingVideos::Video.reset
|
109
|
+
start
|
110
|
+
when "n"
|
111
|
+
goodbye
|
112
|
+
exit
|
113
|
+
when "exit"
|
114
|
+
goodbye
|
115
|
+
exit
|
116
|
+
else
|
117
|
+
puts "Please enter Y to search more videos or N to exit".colorize(:yellow)
|
118
|
+
select_new_location
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def goodbye
|
123
|
+
puts "Come back soon to see the newest climbing videos for your favorite area!".colorize(:light_cyan)
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class SeClimbingVideos::Scraper
|
2
|
+
|
3
|
+
def get_page(link)
|
4
|
+
Nokogiri::HTML(open(link))
|
5
|
+
end
|
6
|
+
|
7
|
+
def make_videos(link, location)
|
8
|
+
self.get_page(link).css("div.yt-lockup-content").each do |video|
|
9
|
+
SeClimbingVideos::Video.new_from_youtube_list(video, location)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class SeClimbingVideos::Video
|
2
|
+
|
3
|
+
attr_accessor :name, :location, :upload_date, :upload_user, :description, :duration, :video_url
|
4
|
+
|
5
|
+
@@all = []
|
6
|
+
|
7
|
+
def self.new_from_youtube_list(video, location)
|
8
|
+
self.new(
|
9
|
+
video.search("a.yt-uix-tile-link").attr("title").text, video.search("div.yt-lockup-byline").text, video.search("span.accessible-description").text.gsub(" - Duration: ", "").gsub(".", ""), ("https://www.youtube.com" + video.search("a.yt-uix-tile-link").attr("href").value), location
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(name=nil, upload_user=nil, duration=nil, video_url=nil, location=nil)
|
14
|
+
@name = name
|
15
|
+
@upload_user = upload_user
|
16
|
+
@duration = duration
|
17
|
+
@video_url = video_url
|
18
|
+
@location = location
|
19
|
+
@@all << self unless @@all.include?(self)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.all
|
23
|
+
@@all
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.reset
|
27
|
+
@@all.clear
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.find(input)
|
31
|
+
self.all[input.to_i-1]
|
32
|
+
end
|
33
|
+
|
34
|
+
def video_doc
|
35
|
+
@video_doc ||= Nokogiri::HTML(open(self.video_url))
|
36
|
+
end
|
37
|
+
|
38
|
+
def description
|
39
|
+
@video_doc.search("br").each {|node| node.replace("\n")}
|
40
|
+
@description ||= @video_doc.search("#eow-description").text
|
41
|
+
end
|
42
|
+
|
43
|
+
def upload_date
|
44
|
+
@upload_date ||= video_doc.search("#watch-uploader-info").text.gsub("Published on ", "").strip
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'se_climbing_videos/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "se_climbing_videos"
|
8
|
+
spec.version = SeClimbingVideos::VERSION
|
9
|
+
spec.date = "2017-01-30"
|
10
|
+
spec.authors = ["Liah Wallace"]
|
11
|
+
spec.email = ["liahwallace1@gmail.com"]
|
12
|
+
|
13
|
+
spec.summary = "Southeast bouldering video aggregator."
|
14
|
+
spec.description = "The Southeast Climbing Videos gem will help you find the newest videos uploaded Youtube for your favorite Southeast Bouldering spot by providing a list of videos by location and upload date."
|
15
|
+
spec.homepage = "https://github.com/liahwallace1/se-climbing-videos-cli-app"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
19
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
20
|
+
# if spec.respond_to?(:metadata)
|
21
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
22
|
+
# else
|
23
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
24
|
+
# "public gem pushes."
|
25
|
+
# end
|
26
|
+
|
27
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
28
|
+
f.match(%r{^(test|spec|features)/})
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
35
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
36
|
+
spec.add_development_dependency "pry", ">=0"
|
37
|
+
spec.add_development_dependency "rspec", ">=0"
|
38
|
+
spec.add_dependency "nokogiri", ">=0"
|
39
|
+
spec.add_dependency "colorize", ">=0"
|
40
|
+
end
|
data/spec.md
ADDED
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: se_climbing_videos
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Liah Wallace
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-01-30 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: '1.13'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.13'
|
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
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: nokogiri
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: colorize
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: The Southeast Climbing Videos gem will help you find the newest videos
|
98
|
+
uploaded Youtube for your favorite Southeast Bouldering spot by providing a list
|
99
|
+
of videos by location and upload date.
|
100
|
+
email:
|
101
|
+
- liahwallace1@gmail.com
|
102
|
+
executables: []
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- ".gitignore"
|
107
|
+
- CODE_OF_CONDUCT.md
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- NOTES.md
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- bin/console
|
114
|
+
- bin/se_climbing_videos
|
115
|
+
- bin/setup
|
116
|
+
- config/environment.rb
|
117
|
+
- end
|
118
|
+
- lib/se_climbing_videos.rb
|
119
|
+
- lib/se_climbing_videos/cli.rb
|
120
|
+
- lib/se_climbing_videos/scraper.rb
|
121
|
+
- lib/se_climbing_videos/version.rb
|
122
|
+
- lib/se_climbing_videos/video.rb
|
123
|
+
- se_climbing_videos.gemspec
|
124
|
+
- spec.md
|
125
|
+
homepage: https://github.com/liahwallace1/se-climbing-videos-cli-app
|
126
|
+
licenses:
|
127
|
+
- MIT
|
128
|
+
metadata: {}
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 2.6.8
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: Southeast bouldering video aggregator.
|
149
|
+
test_files: []
|