How to get items of a wikipedia list article using wikipedia api? - wikipedia-api

How to get items of a Wikipedia list using Wikipedia api. Eg all sports listed on:
http://en.wikipedia.org/wiki/List_of_sports

You just need to add a parameter to set the response format.
format=json

Related

How to get list of wikipedia articles that are in specified category?

If I use this URL to get the Category page
https://en.wikipedia.org/w/api.php?&callback=jQuery111206430303168017417_1453394474227&action=query&prop=revisions&rvprop=content&format=json&titles=Category%3AHacker+(subculture)&_=1453394474245
but I only have a header and other categories, how to get the same page as on Wikipedia with a list of articles?
The Wikimedia API does not return the HTML page as it appears when you browse Wikipedia. If you want that page, you need to call it by its common URL, e.g. https://en.wikipedia.org/wiki/Category:Hacker_%28subculture%29
If you want to use the API to get at the page titles or page ids listed in a certain category, you need to query for category members.
For your query, you would do something like: https://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category%3AHacker+%28subculture%29
Set cmlimit to get more than the default ten pages. Maximum is 500.
You can then parse the JSON to get at the listed page titles or page ids, e.g. to create links to those pages.
Look at the documentation for an explanation of these and other parameters you may use in your query.
The query uses format=jsonfm (for a readable rendering of the data) as a default. Use format=json for your data query.

eBay APIs :: Get related categories using title string

Ok, so this has been asked once before with no answers so i'll give it another bash..
On the eBay website one of the first things you do when listing an item is pass in a string which is the listing title. Given this title string, eBay will go and examine all the categories and pick out a short selection of categories where it thinks you listing will be best suited.
I need to use the bulk File Exchange API and need to find the best category programatically. How can I find the most appropriate categories using one of eBays APIs i.e. is there an API for that?
The only solution I have come up with is to get all the categories using those APIs, then traverse the every category performing some kind of ranking on my inputted listing title (cosine similarity or something).
Any ideas, thanks.
Sounds like you may be able to make use of GetSuggestedCategories.
From the documentation:
Specify keywords describing an item you are looking for using the
Query input field. GetSuggestedCategories returns a list of up to 10
categories that have the highest percentage of listings whose titles
or descriptions contains the specified keywords.

Can the Google CSE API provide the item relevance score?

I'm using the CSE JSON/XML API to search my custom search engine but the results do not include the actual relevance score for each item. Is this completely unsupported or is there a way to retrieve it? I can almost swear I've seen it in the API before :)
There's a "<RK>" ranking element in the (old?) XML API but it's always set to 10 it seems..
The exhaustive list of supported fields in json response is documented here:
https://developers.google.com/custom-search/json-api/v1/reference/cse/list#response
So it seems no, relevance score is not provided.

How to get random page of specific "Portal:" using WikiMedia API

Is there any way to get random article of specific wikimedia portal using wikimedia API?
For example, I need random page of Portal:Science.
Does anyone know how to do this?
What you're asking for doesn't make much sense, because a portal doesn't have a list of pages associated with it.
The closest thing you can do is to get a random page from e.g. Category:Science or one of its subcategories. There is no way to do that directly using the API, you would need to traverse all the subcategories and choose a random page from them by yourself.
There is a tool that already does this (with a limit on the depth of the category tree): erwin85's random article and there is also a template for it on the English Wikipedia.

Foursquare places

We would like to be able to pull out certain places from foursquare an categorize them on our website along with comments from foursquare users. I have the following questions:
1- Can we pull out places and categorize them the way we want on our website? e.g: restaurants/bar/lounge/club/landmarks/others.
2- can we pull out as well phone numbers (when available) and addresses (longitude-lattitude) of places ?
3- Does foursquare have any general descriptive summaries of each place?
Thanks for the help.
Chris
Foursquare has an API, more information can be found at this link
To answer your questions:
Yes, check out the Venues Platform in 4sq API, specifically, the search. When you query the API, as part of the result set for each venue, you get a category
If available, you will get them back under the 'contact' field, check out the response venue object from the search function
Yes, description field, you will need to make an API request to get the complete venue object.
Edit: one last thing, attribute and play nice :)
From my experience, you do not get a lot of venues with 'contact' and 'description' information. But foursquare is not very popular where I test my application, so it might be bad experience - experiment with it yourself.
FourSquare has a great category tree that you can use for categorizing restaurants
http://aboutfoursquare.com/foursquare-categories/
Actually, I'm using this tree in my website:
Dishes Map