wikipedia-client 1.13.0 → 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +171 -0
- data/lib/wikipedia/version.rb +1 -1
- data/wikipedia-client.gemspec +3 -1
- metadata +19 -5
- data/README.textile +0 -169
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c57749d6568f7bb54afd4bd4e76046f0929e4a9d65a41f361fdf173acc5b8eb7
|
4
|
+
data.tar.gz: 4847192d06827db273c03a24729045afa385503992bb054ea1473340b43bb85b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 298686f89d1f5fe977efb1764844dbeb8432cd4bcf3f1c7143e7597c8d5a316d0b7951a6ad603f4804bcab1f2101e41cd1d90ae86bb261c962c345d528e609b7
|
7
|
+
data.tar.gz: eb81094561f2f6b9a1d72a97723014018775fdbf165fe123d7f258b71eea1a2e5f2dc5b27f50fb474966d25e4436e90c7d86b7cc022db6d479bf5daa524285e0
|
data/README.md
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
# Wikipedia API CLient
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/wikipedia-client.svg)](https://badge.fury.io/rb/wikipedia-client)
|
4
|
+
[![Build Status](https://github.com/kenpratt/wikipedia-client/workflows/Test/badge.svg)](https://github.com/kenpratt/wikipedia-client/actions?query=workflow%3ATest)
|
5
|
+
|
6
|
+
|
7
|
+
Allows you to get wikipedia content through their API. This uses the
|
8
|
+
alpha API, not the deprecated query.php API type.
|
9
|
+
|
10
|
+
Wikipedia API reference: <http://en.wikipedia.org/w/api.php>
|
11
|
+
|
12
|
+
Adopted from: <http://code.google.com/p/wikipedia-client/>
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
```
|
17
|
+
gem install wikipedia-client
|
18
|
+
```
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
require 'wikipedia'
|
24
|
+
page = Wikipedia.find( 'Getting Things Done' )
|
25
|
+
#=> #<Wikipedia:Page>
|
26
|
+
|
27
|
+
page.title
|
28
|
+
#=> 'Getting Things Done'
|
29
|
+
|
30
|
+
page.fullurl
|
31
|
+
#=> 'http://en.wikipedia.org/wiki/Getting_Things_Done'
|
32
|
+
|
33
|
+
page.text
|
34
|
+
#=> 'Getting Things Done is a time-management method...'
|
35
|
+
|
36
|
+
page.content
|
37
|
+
#=> all the wiki markup appears here...
|
38
|
+
|
39
|
+
page.summary
|
40
|
+
#=> only the wiki summary appears here...
|
41
|
+
|
42
|
+
page.categories
|
43
|
+
#=> [..., "Category:Self-help books", ...]
|
44
|
+
|
45
|
+
page.links
|
46
|
+
#=> [..., "Business", "Cult following", ...]
|
47
|
+
|
48
|
+
page.extlinks
|
49
|
+
# => [..., "http://www.example.com/", ...]
|
50
|
+
|
51
|
+
page.images
|
52
|
+
#=> ["File:Getting Things Done.jpg", ...]
|
53
|
+
|
54
|
+
page.image_urls
|
55
|
+
#=> ["http://upload.wikimedia.org/wikipedia/en/e/e1/Getting_Things_Done.jpg"]
|
56
|
+
|
57
|
+
page.image_thumburls
|
58
|
+
#=> ["https://upload.wikimedia.org/wikipedia/en/thumb/e/e1/Getting_Things_Done.jpg/200px-Getting_Things_Done.jpg"]
|
59
|
+
|
60
|
+
# or with custom width argument:
|
61
|
+
page.image_thumburls(100)
|
62
|
+
#=> ["https://upload.wikimedia.org/wikipedia/en/thumb/e/e1/Getting_Things_Done.jpg/100px-Getting_Things_Done.jpg"]
|
63
|
+
|
64
|
+
page.image_descriptionurls
|
65
|
+
#=> ["http://en.wikipedia.org/wiki/File:Getting_Things_Done.jpg"]
|
66
|
+
|
67
|
+
page.main_image_url
|
68
|
+
#=> "https://upload.wikimedia.org/wikipedia/en/e/e1/Getting_Things_Done.jpg"
|
69
|
+
|
70
|
+
page.coordinates
|
71
|
+
#=> [48.853, 2.3498, "", "earth"]
|
72
|
+
|
73
|
+
page.templates
|
74
|
+
#=> [..., "Template:About", ...]
|
75
|
+
|
76
|
+
page.langlinks
|
77
|
+
#=> {..., "de"=>"Getting Things Done", "eo"=>"Igi aferojn finitaj", "zh"=>"尽管去做", ...}
|
78
|
+
```
|
79
|
+
|
80
|
+
## Configuration
|
81
|
+
|
82
|
+
This is by default configured like this:
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
Wikipedia.configure {
|
86
|
+
domain 'en.wikipedia.org'
|
87
|
+
path 'w/api.php'
|
88
|
+
}
|
89
|
+
```
|
90
|
+
|
91
|
+
## Advanced
|
92
|
+
|
93
|
+
See the API spec at <http://en.wikipedia.org/w/api.php>.
|
94
|
+
|
95
|
+
If you need data that is not already present, you can override parameters.
|
96
|
+
|
97
|
+
For example, to retrieve only the page info:
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
page = Wikipedia.find( 'Getting Things Done', :prop => "info" )
|
101
|
+
|
102
|
+
page.title
|
103
|
+
#=> "Getting Things Done"
|
104
|
+
|
105
|
+
page.raw_data
|
106
|
+
#=> {"query"=>{"pages"=>{"959928"=>{"pageid"=>959928, "ns"=>0,
|
107
|
+
"title"=>"Getting Things Done", "touched"=>"2010-03-10T00:04:09Z",
|
108
|
+
"lastrevid"=>348481810, "counter"=>0, "length"=>7891}}}}
|
109
|
+
```
|
110
|
+
|
111
|
+
## Contributing
|
112
|
+
|
113
|
+
### Getting the code, and running the tests
|
114
|
+
|
115
|
+
```
|
116
|
+
git clone git@github.com:kenpratt/wikipedia-client.git
|
117
|
+
cd wikipedia-client
|
118
|
+
bundle install
|
119
|
+
bundle exec spec
|
120
|
+
```
|
121
|
+
|
122
|
+
### Pushing a new release of the Gem
|
123
|
+
|
124
|
+
1. Edit `lib/wikipedia/version.rb`, changing `VERSION`.
|
125
|
+
2. Test that the current branch will work as a gem, by testing in an external directory:
|
126
|
+
1. Make a test directory.
|
127
|
+
2. Add a `Gemfile` with:
|
128
|
+
```
|
129
|
+
source 'https://rubygems.org'
|
130
|
+
|
131
|
+
gem 'wikipedia-client', :path => '/path/to/local/wikipedia-client'
|
132
|
+
```
|
133
|
+
|
134
|
+
3. And a `test.rb` file with:
|
135
|
+
```
|
136
|
+
require 'wikipedia'
|
137
|
+
|
138
|
+
page = Wikipedia.find('Ruby')
|
139
|
+
puts page.title
|
140
|
+
```
|
141
|
+
|
142
|
+
4. And then run `bundle install && bundle exec ruby test.rb`
|
143
|
+
3. Build the gem: `bundle exec gem build wikipedia-client.gemspec`.
|
144
|
+
4. Commit the changes: `git commit -a -m 'Version bump to 1.4.0' && git tag v1.4.0 && git push && git push --tag`
|
145
|
+
5. Publish the result to RubyGems: `bundle exec gem push wikipedia-client-1.4.0.gem`.
|
146
|
+
6. Test the released gem in an external directory:
|
147
|
+
1. Make a test directory.
|
148
|
+
2. Add a `Gemfile` with:
|
149
|
+
```
|
150
|
+
source 'https://rubygems.org'
|
151
|
+
|
152
|
+
gem 'wikipedia-client'
|
153
|
+
```
|
154
|
+
|
155
|
+
3. And a `test.rb` file with:
|
156
|
+
```
|
157
|
+
require 'wikipedia'
|
158
|
+
|
159
|
+
page = Wikipedia.find('Ruby')
|
160
|
+
puts page.title
|
161
|
+
```
|
162
|
+
|
163
|
+
4. And then run `bundle install && bundle exec ruby test.rb`
|
164
|
+
|
165
|
+
## Thanks!
|
166
|
+
|
167
|
+
Copyright (c) 2008 Cyril David, released under the MIT license
|
168
|
+
|
169
|
+
Adopted by Ken Pratt (ken@kenpratt.net) in 2010/03
|
170
|
+
|
171
|
+
Thanks to all the [Contributors](https://github.com/kenpratt/wikipedia-client/graphs/contributors).
|
data/lib/wikipedia/version.rb
CHANGED
data/wikipedia-client.gemspec
CHANGED
@@ -23,9 +23,11 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.files = `git ls-files`.split("\n")
|
24
24
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
25
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
26
|
-
s.extra_rdoc_files = ['README.
|
26
|
+
s.extra_rdoc_files = ['README.md']
|
27
27
|
s.bindir = 'bin'
|
28
28
|
|
29
29
|
s.require_paths << 'lib'
|
30
30
|
s.rdoc_options << '--title' << 'wikipedia-client' << '--main' << '-ri'
|
31
|
+
|
32
|
+
s.add_runtime_dependency 'addressable', '~> 2.7'
|
31
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wikipedia-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril David
|
@@ -13,14 +13,28 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2021-04-
|
17
|
-
dependencies:
|
16
|
+
date: 2021-04-29 00:00:00.000000000 Z
|
17
|
+
dependencies:
|
18
|
+
- !ruby/object:Gem::Dependency
|
19
|
+
name: addressable
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - "~>"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '2.7'
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - "~>"
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '2.7'
|
18
32
|
description: Ruby client for the Wikipedia API
|
19
33
|
email: ken@kenpratt.net
|
20
34
|
executables: []
|
21
35
|
extensions: []
|
22
36
|
extra_rdoc_files:
|
23
|
-
- README.
|
37
|
+
- README.md
|
24
38
|
files:
|
25
39
|
- ".editorconfig"
|
26
40
|
- ".github/workflows/test.yml"
|
@@ -28,7 +42,7 @@ files:
|
|
28
42
|
- ".rubocop.yml"
|
29
43
|
- Gemfile
|
30
44
|
- MIT-LICENSE
|
31
|
-
- README.
|
45
|
+
- README.md
|
32
46
|
- Rakefile
|
33
47
|
- init.rb
|
34
48
|
- install.rb
|
data/README.textile
DELETED
@@ -1,169 +0,0 @@
|
|
1
|
-
h1. Wikipedia
|
2
|
-
|
3
|
-
!https://badge.fury.io/rb/wikipedia-client.svg!:https://badge.fury.io/rb/wikipedia-client !https://travis-ci.org/kenpratt/wikipedia-client.svg?branch=master!:https://travis-ci.org/kenpratt/wikipedia-client
|
4
|
-
|
5
|
-
Allows you to get wikipedia content through their API. This uses the
|
6
|
-
alpha API, not the deprecated query.php API type
|
7
|
-
|
8
|
-
Wikipedia API reference: "http://en.wikipedia.org/w/api.php":http://en.wikipedia.org/w/api.php
|
9
|
-
|
10
|
-
Adopted from: "http://code.google.com/p/wikipedia-client/":http://code.google.com/p/wikipedia-client/
|
11
|
-
|
12
|
-
h2. Installation
|
13
|
-
|
14
|
-
<pre><code>gem install wikipedia-client</code></pre>
|
15
|
-
|
16
|
-
h2. Examples
|
17
|
-
|
18
|
-
<pre><code>require 'wikipedia'
|
19
|
-
page = Wikipedia.find( 'Getting Things Done' )
|
20
|
-
|
21
|
-
=> #<Wikipedia:Page>
|
22
|
-
|
23
|
-
page.title
|
24
|
-
|
25
|
-
=> 'Getting Things Done'
|
26
|
-
|
27
|
-
page.fullurl
|
28
|
-
|
29
|
-
=> 'http://en.wikipedia.org/wiki/Getting_Things_Done'
|
30
|
-
|
31
|
-
page.text
|
32
|
-
|
33
|
-
=> 'Getting Things Done is a time-management method...'
|
34
|
-
|
35
|
-
page.content
|
36
|
-
|
37
|
-
=> # all the wiki markup appears here...
|
38
|
-
|
39
|
-
page.summary
|
40
|
-
|
41
|
-
=> # only the wiki summary appears here...
|
42
|
-
|
43
|
-
page.categories
|
44
|
-
|
45
|
-
=> [..., "Category:Self-help books", ...]
|
46
|
-
|
47
|
-
page.links
|
48
|
-
|
49
|
-
=> [..., "Business", "Cult following", ...]
|
50
|
-
|
51
|
-
page.extlinks
|
52
|
-
|
53
|
-
=> [..., "http://www.example.com/", ...]
|
54
|
-
|
55
|
-
page.images
|
56
|
-
|
57
|
-
=> ["File:Getting Things Done.jpg", ...]
|
58
|
-
|
59
|
-
page.image_urls
|
60
|
-
|
61
|
-
=> ["http://upload.wikimedia.org/wikipedia/en/e/e1/Getting_Things_Done.jpg"]
|
62
|
-
|
63
|
-
default width: 200
|
64
|
-
|
65
|
-
page.image_thumburls
|
66
|
-
|
67
|
-
=> ["https://upload.wikimedia.org/wikipedia/en/thumb/e/e1/Getting_Things_Done.jpg/200px-Getting_Things_Done.jpg"]
|
68
|
-
|
69
|
-
or with custom width argument:
|
70
|
-
|
71
|
-
page.image_thumburls(100)
|
72
|
-
|
73
|
-
=> ["https://upload.wikimedia.org/wikipedia/en/thumb/e/e1/Getting_Things_Done.jpg/100px-Getting_Things_Done.jpg"]
|
74
|
-
|
75
|
-
page.image_descriptionurls
|
76
|
-
|
77
|
-
=> ["http://en.wikipedia.org/wiki/File:Getting_Things_Done.jpg"]
|
78
|
-
|
79
|
-
page.main_image_url
|
80
|
-
|
81
|
-
=> "https://upload.wikimedia.org/wikipedia/en/e/e1/Getting_Things_Done.jpg"
|
82
|
-
|
83
|
-
page.coordinates
|
84
|
-
|
85
|
-
=> [48.853, 2.3498, "", "earth"]
|
86
|
-
|
87
|
-
page.templates
|
88
|
-
|
89
|
-
=> [..., "Template:About", ...]
|
90
|
-
|
91
|
-
page.langlinks
|
92
|
-
|
93
|
-
=> {..., "de"=>"Getting Things Done", "eo"=>"Igi aferojn finitaj", "zh"=>"尽管去做", ...}</code></pre>
|
94
|
-
|
95
|
-
h2. Configuration
|
96
|
-
|
97
|
-
This is by default configured like this:
|
98
|
-
|
99
|
-
<pre><code>Wikipedia.configure {
|
100
|
-
domain 'en.wikipedia.org'
|
101
|
-
path 'w/api.php'
|
102
|
-
}</code></pre>
|
103
|
-
|
104
|
-
h2. Advanced
|
105
|
-
|
106
|
-
See the API spec at "http://en.wikipedia.org/w/api.php":http://en.wikipedia.org/w/api.php
|
107
|
-
|
108
|
-
If you need data that is not already present, you can override parameters.
|
109
|
-
|
110
|
-
For example, to retrieve only the page info:
|
111
|
-
|
112
|
-
<pre><code>page = Wikipedia.find( 'Getting Things Done', :prop => "info" )
|
113
|
-
|
114
|
-
page.title
|
115
|
-
|
116
|
-
=> "Getting Things Done"
|
117
|
-
|
118
|
-
page.raw_data
|
119
|
-
|
120
|
-
=> {"query"=>{"pages"=>{"959928"=>{"pageid"=>959928, "ns"=>0,
|
121
|
-
"title"=>"Getting Things Done", "touched"=>"2010-03-10T00:04:09Z",
|
122
|
-
"lastrevid"=>348481810, "counter"=>0, "length"=>7891}}}}</code></pre>
|
123
|
-
|
124
|
-
h2. Contributing
|
125
|
-
|
126
|
-
h3. Getting the code, and running the tests
|
127
|
-
|
128
|
-
<pre><code>git clone git@github.com:kenpratt/wikipedia-client.git
|
129
|
-
cd wikipedia-client
|
130
|
-
gem install bundler
|
131
|
-
bundle exec rake spec</code></pre>
|
132
|
-
|
133
|
-
h3. Pushing a new release of the Gem
|
134
|
-
|
135
|
-
Edit <code>lib/wikipedia/version.rb</code>, changing <code>VERSION</code>.
|
136
|
-
|
137
|
-
Build the gem: <code>bundle exec gem build wikipedia-client.gemspec</code>
|
138
|
-
|
139
|
-
Commit the changes: <code>git commit -a -m 'Version bump to 1.4.0' && git push</code>
|
140
|
-
|
141
|
-
Publish the result to RubyGems: <code>bundle exec gem push wikipedia-client-1.4.0.gem</code>
|
142
|
-
|
143
|
-
h2. Thanks!
|
144
|
-
|
145
|
-
Copyright (c) 2008 [Cyril David], released under the MIT license
|
146
|
-
|
147
|
-
Adopted by Ken Pratt (ken@kenpratt.net) in 2010/03
|
148
|
-
|
149
|
-
h3. Contributors
|
150
|
-
|
151
|
-
Aishwarya Subramanian <aishwarya923@gmail.com>
|
152
|
-
Bryce <brycedneal@gmail.com>
|
153
|
-
cdr-data <b_rhettbarber@yahoo.com>
|
154
|
-
Christian Hellsten <christian.hellsten@gmail.com>
|
155
|
-
Christopher Quackenbush <christopher@quackenbush.me>
|
156
|
-
Cyril David
|
157
|
-
Danny Ben Shitrit <db@dannyben.com>
|
158
|
-
Francesco Serra <afnecors@gmail.com>
|
159
|
-
Harman Singh
|
160
|
-
ivobenedito <ivobenedito@gmail.com>
|
161
|
-
Justin Harrison <justin@matthin.com>
|
162
|
-
Ken Pratt <ken@kenpratt.net>
|
163
|
-
Manu Manu <manuisfunny@gmail.com>
|
164
|
-
Mike Haugland <mike.haugland@bravenet.com>
|
165
|
-
Pietro F. Menna <pietromenna@yahoo.com>
|
166
|
-
Sophie Rapoport <sfrapoport@gmail.com>
|
167
|
-
tsukasaoishi <tsukasa.oishi@gmail.com>
|
168
|
-
V <thevalentino@gmail.com>
|
169
|
-
Ilgiz Mustafin <ilgimustafin@gmail.com>
|