Hi, Hi,
for an URL like
http://en.wikipedia.org/w/api.php?action=parse&format=txt&page=Parag...
I would like to remove the extraneous (array) info at the top
Array ( [parse] => Array ( [title] => Paraguayan guaranà [revid] => 504403853 [text] =>
and the long appended text
so that I am only receiving the mobile html with no images.
Help!
[langlinks] => Array ( [0] => Array ( [lang] => ar [url] => http://ar.wikipedia.org/wiki/%D8%BA%D9%88%D8%A7%D8%B1%D8%A7%D9%86%D9%8A_%D8%...] => غواراني باراغواي ) [1] => Array ( [lang] => gn [url] => http://gn.wikipedia.org/wiki/Guarani_(viru) [*] => Guarani (viru) ) [2] => Array ( [lang] => ca [url] => http://ca.wikipedia.org/wiki/Guaran%C3%AD_(moneda) [*] => Guaranà (moneda) ) [3] => Array ( [lang] => cs [url] => http://cs.wikipedia.org/wiki/Paraguaysk%C3%BD_guaran%C3%AD [*] => Paraguayský guaranà ) [4] => Array ( [lang] => de [url] => http://de.wikipedia.org/wiki/Paraguayischer_Guaran%C3%AD [*] => Paraguayischer Guaranà ) [5] => Array ( [lang] => el [url] => http://el.wikipedia.org/wiki/%CE%93%CE%BA%CE%BF%CF%85%CE%B1%CF%81%CE%B1%CE%B...] => Î“ÎºÎ¿Ï…Î±Ï Î±Î½Î¯ (νόμισμα) ) [6] => Array ( [lang] => es [url] => http://es.wikipedia.org/wiki/Guaran%C3%AD_(moneda_de_Paraguay) [*] => Guaranà (moneda de Paraguay) ) [7] => Array ( [lang] => eo [url] => http://eo.wikipedia.org/wiki/Paragvaja_gvaranio [*] => Paragvaja gvaranio ) [8] => Array ( [lang] => fr [url] => http://fr.wikipedia.org/wiki/Guaran%C3%AD_(monnaie) [*] => Guaranà (monnaie) ) [9] => Array ( [lang] => gl [url] => http://gl.wikipedia.org/wiki/Guaran%C3%AD_(moeda) [*] => Guaranà (moeda) ) [10] => Array ( [lang] => ko [url] => http://ko.wikipedia.org/wiki/%ED%8C%8C%EB%9D%BC%EA%B3%BC%EC%9D%B4_%EA%B3%BC%...] => íŒŒë ¼ê³¼ì ´ ê³¼ë ¼ë‹ˆ ) [11] => Array ( [lang] => hr [url] => http://hr.wikipedia.org/wiki/Paragvajski_gvarani [*] => Paragvajski gvarani ) [12] => Array ( [lang] => bpy [url] =>
--- *The very best place for news about Nimble: *http://www.quora.com/ncp
On Tue, Aug 14, 2012 at 5:48 PM, Fred Zimmerman wfz@nimblebooks.com wrote:
Hi, Hi,
for an URL like
http://en.wikipedia.org/w/api.php?action=parse&format=txt&page=Parag...
I would like to remove the extraneous (array) info at the top
Array ( [parse] => Array ( [title] => Paraguayan guaranà [revid] => 504403853 [text] =>
and the long appended text
so that I am only receiving the mobile html with no images.
Help!
The response is going to be wrapped in *some* format, be it XML, JSON, PHP or something else, because it is structured. The API currently doesn't offer a facility for getting just one property from the structured response and outputting it raw.
Roan
--- *The very best place for news about Nimble: *http://www.quora.com/ncp
Pardon my stupidity, I'm new at this ...
I know how to unwrap this txt format simply using sed to delete before and after ...
Is there a more intelligent standard approach to unwrapping JSON?
Fred
On Tue, Aug 14, 2012 at 9:10 PM, Roan Kattouw roan.kattouw@gmail.comwrote:
The response is going to be wrapped in *some* format, be it XML, JSON, PHP or something else, because it is structured. The API currently doesn't offer a facility for getting just one property from the structured response and outputting it raw.
Roan
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Most languages have either built in (or easy to add) libraries for wrapping and unwrapping JSON data into a native format (such as an array, associative array, hashmap, what ever your language calls it)
What language/platform are you using?
On Wed, Aug 15, 2012 at 8:21 AM, Fred Zimmerman wfz@nimblebooks.com wrote:
Pardon my stupidity, I'm new at this ...
I know how to unwrap this txt format simply using sed to delete before and after ...
Is there a more intelligent standard approach to unwrapping JSON?
Fred
bash/python
--- *The very best place for news about Nimble: *http://www.quora.com/ncp
On Wed, Aug 15, 2012 at 9:16 AM, C Stafford c.stafford@gmail.com wrote:
Most languages have either built in (or easy to add) libraries for wrapping and unwrapping JSON data into a native format (such as an array, associative array, hashmap, what ever your language calls it)
What language/platform are you using?
On Wed, Aug 15, 2012 at 8:21 AM, Fred Zimmerman wfz@nimblebooks.com wrote:
Pardon my stupidity, I'm new at this ...
I know how to unwrap this txt format simply using sed to delete before
and
after ...
Is there a more intelligent standard approach to unwrapping JSON?
Fred
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
http://docs.python.org/library/json.html
Make all your API calls with format=json, then feed the returned text into the json.* functions, ???, profit!
On Wed, Aug 15, 2012 at 9:35 AM, Fred Zimmerman wfz@nimblebooks.com wrote:
bash/python
I was able to succeed with a bash tool called jshon. i am stupidly quite proficient w bash but not python.
--- *The very best place for news about Nimble: *http://www.quora.com/ncp
On Thu, Aug 16, 2012 at 9:19 AM, C Stafford c.stafford@gmail.com wrote:
http://docs.python.org/library/json.html
Make all your API calls with format=json, then feed the returned text into the json.* functions, ???, profit!
On Wed, Aug 15, 2012 at 9:35 AM, Fred Zimmerman wfz@nimblebooks.com wrote:
bash/python
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
mediawiki-api@lists.wikimedia.org