Getting a list of words from a page

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting a list of words from a page

Brandon Keith Biggs

Hello,

I am new with using the API and can’t seem to get the list of words from:

https://en.wiktionary.org/wiki/Category:English_agent_nouns

 

I have managed to get the page:

https://en.wiktionary.org/w/api.php?format=jsonfm&formatversion=2&titles=Category:English_agent_nouns&action=query

 

But nothing I have tried has worked. I originally tried:

https://en.wiktionary.org/w/api.php?format=jsonfm&formatversion=2&titles=Category:English_agent_nouns&action=query&list=allpages

 

and I would expect for a list of pages (aka words) with a title attribute to show up, but instead I get titles such as: "title": "!" which is not very useful.

I have also tried going through all the props, but still nothing. I don’t really understand props and list, but something should have given all the words.

 

My goal is to use request to fetch the JSON so I can use the words in a script.

Are there any tutorials or guides that go into getting lists of words like this?

Thank you,



_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Reply | Threaded
Open this post in threaded view
|

Re: Getting a list of words from a page

Steve Siznax
See https://www.mediawiki.org/wiki/API:Categorymembers

The API limit is 500. Here are the first 500:

<a href="https://en.wiktionary.org/w/api.php?action=query&amp;formatversion=2&amp;list=categorymembers&amp;cmlimit=500&amp;cmtitle=Category:English agent nouns" class="">https://en.wiktionary.org/w/api.php?action=query&formatversion=2&list=categorymembers&cmlimit=500&cmtitle=Category%3AEnglish%20agent%20nouns

Wptools (python) can probably simplify your task:

>>> import wptools
>>> cat = wptools.category('Category:English agent nouns', wiki='en.wiktionary.org')
>>> cat.get_members()
>>> len(cat.data['members'])
576



On Jan 12, 2018, at 2:30 PM, Brandon Keith Biggs <[hidden email]> wrote:

Hello,

I am new with using the API and can’t seem to get the list of words from:

https://en.wiktionary.org/wiki/Category:English_agent_nouns

 

I have managed to get the page:

https://en.wiktionary.org/w/api.php?format=jsonfm&formatversion=2&titles=Category:English_agent_nouns&action=query

 

But nothing I have tried has worked. I originally tried:

https://en.wiktionary.org/w/api.php?format=jsonfm&formatversion=2&titles=Category:English_agent_nouns&action=query&list=allpages

 

and I would expect for a list of pages (aka words) with a title attribute to show up, but instead I get titles such as: "title": "!" which is not very useful.

I have also tried going through all the props, but still nothing. I don’t really understand props and list, but something should have given all the words.

 

My goal is to use request to fetch the JSON so I can use the words in a script.

Are there any tutorials or guides that go into getting lists of words like this?

Thank you,


_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api


_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Reply | Threaded
Open this post in threaded view
|

Re: Getting a list of words from a page

Brandon Keith Biggs
Hello Steve,
This is perfect! I don't know why I didn't see categorymembers before. I think I will use the wptools though, because it is much faster.

Hm, it looks like -ant is missing from this list.
Thank you,



On Fri, Jan 12, 2018 at 4:22 PM, Steve Siznax <[hidden email]> wrote:
See https://www.mediawiki.org/wiki/API:Categorymembers

The API limit is 500. Here are the first 500:


Wptools (python) can probably simplify your task:

>>> import wptools
>>> cat = wptools.category('Category:English agent nouns', wiki='en.wiktionary.org')
>>> cat.get_members()
>>> len(cat.data['members'])
576



On Jan 12, 2018, at 2:30 PM, Brandon Keith Biggs <[hidden email]> wrote:

Hello,

I am new with using the API and can’t seem to get the list of words from:

https://en.wiktionary.org/wiki/Category:English_agent_nouns

 

I have managed to get the page:

https://en.wiktionary.org/w/api.php?format=jsonfm&formatversion=2&titles=Category:English_agent_nouns&action=query

 

But nothing I have tried has worked. I originally tried:

https://en.wiktionary.org/w/api.php?format=jsonfm&formatversion=2&titles=Category:English_agent_nouns&action=query&list=allpages

 

and I would expect for a list of pages (aka words) with a title attribute to show up, but instead I get titles such as: "title": "!" which is not very useful.

I have also tried going through all the props, but still nothing. I don’t really understand props and list, but something should have given all the words.

 

My goal is to use request to fetch the JSON so I can use the words in a script.

Are there any tutorials or guides that go into getting lists of words like this?

Thank you,


_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api


_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api



_______________________________________________
Mediawiki-api mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api