anotherTopSeventy 0.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.
- checksums.yaml +7 -0
- data/lib/anotherTopSeventy.rb +40 -0
- metadata +42 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2fd3bdda2217874b33eb9e82a00f6079515605f25abb6863dd7a2db8fbdd47c6
|
4
|
+
data.tar.gz: 4d48d1f8adb2d42a156805057c1afdae212e6016610ecc42ebc237093f8f8a40
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9006a8687cfa8fac4bea575bc44ee47bf5f38be1f6341b0bf6dfadd97bad1588b6efd326a4a88cda1a98185fc5bcfc4c5d2f5e56fb3fa3ae79fdbd35c79fbc24
|
7
|
+
data.tar.gz: 28c8095a378a24b19f31846634195ca2eadcd4a495de576f087fba9d9a3972d315cbcf9264ea6c1a04cbf98ed7cc71a45cf2eaf2622213ee4438c19681d8430f
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'httparty'
|
3
|
+
|
4
|
+
def anotherTopSeventy
|
5
|
+
url = "https://www.guru99.com/best-udemy-course.html"
|
6
|
+
unparsed_page = HTTParty.get(url) # gets back raw HTML
|
7
|
+
parsed_page = Nokogiri::HTML(unparsed_page) # nokogiri converts the unparsed page to parsed page
|
8
|
+
|
9
|
+
@web_courses = Array.new
|
10
|
+
@web_links = Array.new
|
11
|
+
|
12
|
+
# Iterate over and store the values into a object with key values
|
13
|
+
courseListings = parsed_page.css('div.list-view-course-card--content--1TGG4') # used CSS selector to target the values # 70 courses
|
14
|
+
|
15
|
+
# Another section of the page for the anchor tags
|
16
|
+
courseLinks = parsed_page.css('div.g-block.size-60') # target card elements for links
|
17
|
+
|
18
|
+
courseListings.each do | course_listing |
|
19
|
+
course = {
|
20
|
+
course_title: course_listing.css('div.list-view-course-card--title--2pfA0').text, # course_title
|
21
|
+
course_stats: course_listing.css('span.ml5').text, # course stats
|
22
|
+
}
|
23
|
+
@web_courses << course
|
24
|
+
end
|
25
|
+
|
26
|
+
courseLinks.each do | course_links |
|
27
|
+
link = {
|
28
|
+
course_links: course_links.css('a')[0].attributes["href"].value # course_links
|
29
|
+
}
|
30
|
+
@web_links << link
|
31
|
+
end
|
32
|
+
|
33
|
+
def multireturn
|
34
|
+
return [@web_courses, @web_links]
|
35
|
+
end
|
36
|
+
|
37
|
+
a, b = multireturn
|
38
|
+
a = @web_courses.join(', ')
|
39
|
+
b = @web_links.join(', ')
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: anotherTopSeventy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- MatthewByrne
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-04-12 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple but hopefully effective educational gem
|
14
|
+
email: x17138744@student.ncirl.ie
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/anotherTopSeventy.rb
|
20
|
+
homepage: http://rubygems.org/gems/udemySeventy
|
21
|
+
licenses: []
|
22
|
+
metadata: {}
|
23
|
+
post_install_message:
|
24
|
+
rdoc_options: []
|
25
|
+
require_paths:
|
26
|
+
- lib
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
requirements: []
|
38
|
+
rubygems_version: 3.2.15
|
39
|
+
signing_key:
|
40
|
+
specification_version: 4
|
41
|
+
summary: A web scraped collection of the top seventy Udemy courses in 2021
|
42
|
+
test_files: []
|