google_parser 0.1.0 → 0.1.1
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 +4 -4
- data/README.md +14 -28
- data/lib/google_parser/version.rb +1 -1
- data/lib/google_parser.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cb5f3f28911b2ee0b238d660efa69063faf41c40157e94f1cb590df36c98929
|
4
|
+
data.tar.gz: 65bc37bb93ae44cd13ab1f3b07b6004954d96e1e4e9cb6c23d5cfbea76ad859c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90ee59a668d5d5861c4aebf3e2def26b626532abc150b768678edf5e65f52de5319635b4656ab007d021ecd7173e9527d1ba377b0d0803166c277b6128973018
|
7
|
+
data.tar.gz: 9d49b8a1f8509923e16ff7dfa338ec55514ec09da1eacf9fa19063983b08e998679d3bb52ddbea9b43528423135f4f3d11942a0f5783fa29ce9541ad71449c42
|
data/README.md
CHANGED
@@ -1,35 +1,21 @@
|
|
1
|
-
|
1
|
+
Google Parser
|
2
|
+
=============
|
3
|
+
Google Parser is a ruby library that extracts keyword rankings from a Google SERP html page.
|
2
4
|
|
3
|
-
|
5
|
+
## Example
|
6
|
+
```ruby
|
7
|
+
html = reponse.body # Custom scraping logic
|
4
8
|
|
5
|
-
|
9
|
+
google_parser = GoogleParser::GoogleParser.new(html)
|
10
|
+
google_parser.organic_results
|
11
|
+
```
|
6
12
|
|
7
13
|
## Installation
|
8
14
|
|
9
|
-
|
15
|
+
Add the following to your `Gemfile`:
|
10
16
|
|
11
|
-
|
17
|
+
```ruby
|
18
|
+
gem "google_parser", "~> 0.1.0"
|
19
|
+
```
|
12
20
|
|
13
|
-
|
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.
|
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.
|
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:
|
11
|
+
date: 2024-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|