google_parser 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76ced4f6c307e04166d79f3cdff8eef98cbf76cf3668d8a1945edd0b9185c1c9
4
- data.tar.gz: 231973730cea75a1be4698cbce1e0f537f4c56f698892e522c96cefd9536d0bd
3
+ metadata.gz: 9cb5f3f28911b2ee0b238d660efa69063faf41c40157e94f1cb590df36c98929
4
+ data.tar.gz: 65bc37bb93ae44cd13ab1f3b07b6004954d96e1e4e9cb6c23d5cfbea76ad859c
5
5
  SHA512:
6
- metadata.gz: adec3d65b94f63cdd17bf3197d84a31361a215549c0774dfee58aa8b053bab3a760d2d73defee81ada1273c56460b4957aae7589eeb1610505d7cc39decfcd49
7
- data.tar.gz: a65ecb950d44c8bfc1510a7bc0aa8e3838709b038a7248c85d323bef5747e97a9e21d7af3e987a019b0fdb491040c8fbeb6c2f593f120309d5a937e5ce097973
6
+ metadata.gz: 90ee59a668d5d5861c4aebf3e2def26b626532abc150b768678edf5e65f52de5319635b4656ab007d021ecd7173e9527d1ba377b0d0803166c277b6128973018
7
+ data.tar.gz: 9d49b8a1f8509923e16ff7dfa338ec55514ec09da1eacf9fa19063983b08e998679d3bb52ddbea9b43528423135f4f3d11942a0f5783fa29ce9541ad71449c42
data/README.md CHANGED
@@ -1,35 +1,21 @@
1
- # GoogleParser
1
+ Google Parser
2
+ =============
3
+ Google Parser is a ruby library that extracts keyword rankings from a Google SERP html page.
2
4
 
3
- TODO: Delete this and the text below, and describe your gem
5
+ ## Example
6
+ ```ruby
7
+ html = reponse.body # Custom scraping logic
4
8
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/google_parser`. To experiment with that code, run `bin/console` for an interactive prompt.
9
+ google_parser = GoogleParser::GoogleParser.new(html)
10
+ google_parser.organic_results
11
+ ```
6
12
 
7
13
  ## Installation
8
14
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
15
+ Add the following to your `Gemfile`:
10
16
 
11
- Install the gem and add to the application's Gemfile by executing:
17
+ ```ruby
18
+ gem "google_parser", "~> 0.1.0"
19
+ ```
12
20
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
14
-
15
- If bundler is not being used to manage dependencies, install the gem by executing:
16
-
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
- ## Development
24
-
25
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
-
27
- 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
-
29
- ## Contributing
30
-
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/google_parser.
32
-
33
- ## License
34
-
35
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
21
+ or run `gem install google_parser` to install it globally.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GoogleParser
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/google_parser.rb CHANGED
@@ -14,7 +14,7 @@ module GoogleParser
14
14
  @raw_html = raw_html
15
15
  @doc = Nokogiri::HTML(raw_html)
16
16
  @organic_results = []
17
- @jsmodel = @doc.css("body").attr("jsmodel").value
17
+ @jsmodel = @doc.css("body").attr("jsmodel").value&.strip!
18
18
 
19
19
  parse_organic_results
20
20
  rescue StandardError => e
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rasmus Kjellberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-06 00:00:00.000000000 Z
11
+ date: 2024-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri