Module: MediaWiktory::Wikipedia::Modules::Extlinks
- Defined in:
- lib/mediawiktory/wikipedia/modules/extlinks.rb
Overview
Returns all external URLs (not interwikis) from the given pages.
The "submodule" (MediaWiki API term) is included in action after setting some param, providing additional tweaking for this param. Example (for Actions::Query and its submodules):
api.query # returns Actions::Query
.prop(:revisions) # adds prop=revisions to action URL, and includes Modules::Revisions into action
.limit(10) # method of Modules::Revisions, adds rvlimit=10 to URL
All submodule's parameters are documented as its public methods, see below.
Instance Method Summary collapse
-
#expandurl ⇒ self
Expand protocol-relative URLs with the canonical protocol.
-
#limit(value) ⇒ self
How many links to return.
-
#offset(value) ⇒ self
When more results are available, use this to continue.
-
#protocol(value) ⇒ self
Protocol of the URL.
-
#query(value) ⇒ self
Search string without protocol.
Instance Method Details
#expandurl ⇒ self
Expand protocol-relative URLs with the canonical protocol.
61 62 63 |
# File 'lib/mediawiktory/wikipedia/modules/extlinks.rb', line 61 def () merge(elexpandurl: 'true') end |
#limit(value) ⇒ self
How many links to return.
25 26 27 |
# File 'lib/mediawiktory/wikipedia/modules/extlinks.rb', line 25 def limit(value) merge(ellimit: value.to_s) end |
#offset(value) ⇒ self
When more results are available, use this to continue.
33 34 35 |
# File 'lib/mediawiktory/wikipedia/modules/extlinks.rb', line 33 def offset(value) merge(eloffset: value.to_s) end |
#protocol(value) ⇒ self
Protocol of the URL. If empty and elquery is set, the protocol is http. Leave both this and elquery empty to list all external links.
41 42 43 |
# File 'lib/mediawiktory/wikipedia/modules/extlinks.rb', line 41 def protocol(value) _protocol(value) or fail ArgumentError, "Unknown value for protocol: #{value}" end |
#query(value) ⇒ self
Search string without protocol. Useful for checking whether a certain page contains a certain external url.
54 55 56 |
# File 'lib/mediawiktory/wikipedia/modules/extlinks.rb', line 54 def query(value) merge(elquery: value.to_s) end |