Mentions légales du service

Skip to content
Snippets Groups Projects

[gen:wiki] change method to get page text content

Merged POUILLOUX Laurent requested to merge fix_mw_api_content_retrieve into master
@@ -6,20 +6,23 @@ module MediawikiApi
class Client
def get_page_content(page_name)
get_conn = Faraday.new(url: MW::BASE_URL + "index.php/#{page_name}") do |faraday|
get_conn = Faraday.new(url: MW::API_URL) do |faraday|
faraday.request :multipart
faraday.request :url_encoded
faraday.use :cookie_jar, jar: @cookies
faraday.use FaradayMiddleware::FollowRedirects
faraday.adapter Faraday.default_adapter
end
params = {
:token_type => false,
:action => 'raw'
params = {
:action => 'parse',
:page => page_name,
:prop => 'wikitext',
:formatversion => '2',
:format => 'json'
}
params[:token] = get_token(:csrf)
res = get_conn.send(:get, '', params)
res.body
JSON::parse(res.body)["parse"]["wikitext"]
end
def get_file_content(file_name)
Loading