How to get random page of specific "Portal:" using WikiMedia API - 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.

Related

How to get all Wikipedia article titles?

How to get all Wikipedia article titles in one place without extra characters and pageids. Just the article's title. Something like this:
When I download wikipedia dump, I get this
Maybe I know a movement that might get me all pages but I wanted to get all pages in one take.
You'll find it on https://dumps.wikimedia.org
The latest List of page titles in main namespace for English Wikipedia as a database dump is here (69 MB).
If you rather want it through the API you use query and list=allpages but that only give you maximum 500 (5k for bots) at a time, so you will have to make more than 10 000 API calls for the English Wikipedia.
Example: https://en.wikipedia.org/w/api.php?action=query&format=xml&list=allpages&aplimit=max

Instagram: sort photos with a specific tag with most likes

I'm running a contest on the web where the image with the most likes wins. It's tiresom having to go through 900 images manually so what I want to do is, sort all images with the tag lets say #computer after the amount of likes, with the most liked pics on top. I have searched the net like crazy for some program or site that does this (ExtraGram, gramhoot, statigram, webstagram) but none offer to sort by amount of likes and it drives me INSANE! It's a really relevant request.
I've tried istafeed.js but it doesn't include all images, actually it leaves out the ones with the moest likes which defies the purpose.
There's nothing I know of in the Instagram API that sends back media sorted by likes in advance. I don't think there's a tool to do this either, but writing one is relatively simple IMO and I've done it before for a contest specifically.
The simplest thing to do is to do the following:
Use the Instagram API (via a library or pure REST) to query by tag. For instance, if you only care about the most recently tagged media or you want to process by date, you can use the [/tag/tag-name/media/recent][1] enpoint.
Page through each result page by processing the next_max_id/next_max_tag_id.
Collect the results locally into a database. You will receive the "like" count for each media item. You will have to update the data if you want to track the likes over time.
Sort the results using your database or if it's a small result set, you could skip #3 and just sort in memory.
If you need to refresh the results, you need to subscribe to the Tag via the API. You can give Instagram a URL to then push updates, and then you'll have to retrieve 1 or media items and update them in your database accordingly.
You will of course need to register your application with Instagram to get an API key if you want to do this. Then you can either send them your client_id or use OAuth.
The best way to achieve this is to pull the photos in and then sort them programmatically based on the likes numeric value. I've designed a plugin that does this automatically for you for anyone interested.
Instagram Journal

Search Apple App store by genre with iOS/Obj-c

How would you use Obj-c to search the Apple App store to do the following...
Return the details of the top 100 in the games overall category or a
specific games category
Return the details of a specific games in the games category
Anyone?
Well, as far as I know you have two methods to search the App Store:
Search API;
RSS feed generator.
There are many differences between those but the most relevant for your example is that with the Search API you cannot sort the results as they come sorted by relevance and it requires always a search term. The RSS feed generator already has Top Free, Top Paid and Top Grossing categories for you.
Given this I'm going to start answering your question for the RSS feed generator.
You use the RSS feed generator to generate feeds like this for the top 100 free games in the US store: https://itunes.apple.com/us/rss/topfreeapplications/limit=100/genre=6014/xml;
Take a loot at this link to get games sub genres;
You use NSXMLParser library to parse the RSS which already includes the app details.
You may use the initWithContentsOfUrl: method of NSXMLParser;
A quick how-to for this part can be found here.
You can also use StoreKit to get the details of the apps by their ID or show a modal view controller with a specific app but that will require an extra network request.
For the sake of completeness I'll also cover how you can use the Search API.
Use the Search API to create a URL that describes your search:
A URL like this allow you to search for apps with that matches "angry birds" - https://itunes.apple.com/search?term=angry+birds&media=software.
Process the results using NSJSONSerialization library. That already includes the app details.
Take a loot at this tutorial on how to use the NSJSONSerialization library.
In the end, as #Numan said, this two methods accomplish different things. You said you wanted to have the top 100 games from a specific category and also said you needed to search for a specific game.
You can use my descriptions to create one class that interacts with the App Store in these two ways and return an object defined by you that describes an app (or an array of objects).
You can access this info by RSS, look here http://www.apple.com/rss/
Also you can generate RSS feed http://itunes.apple.com/rss/generator/

know the page rank for certain key words

I want to know the page rank for certain key words against my page. For example I wrote "best movies 2012" my page does come, but in 30th to 50th page. I want to query in the result set Google gave against my keywords so that I can see the rank of my page and my competitors against typical keywords.
I think you may be confusing PageRank with positions. PageRank is an algorithm that Google uses to determine the authority of your site. This doesn't always affect the positions of certain keywords.
There are plenty of good programs and web services around that you can use such as
http://raventools.com/
Most of the good free web services have been closed down due to Google now limiting the amount of searches performed and charging for this data.
You could check out:
http://www.semrush.com
It's free but you have to register to get data.
There are several web services providing this functionality: http://raventools.com/ or http://seomoz.org/
Or, you can perform the task manually. Here is an example on how to query google search using Java: How can you search Google Programmatically Java API
You need to compare your webpage PageRank and website PR against those of the competition. The best indication we have of website PR is the HomePage PagRank.
Ensure that you do this for the appropriate Google domain - USA - Google.com - UK Google.co.uk etc
The technique is described in more detail on http://www.keywordseopro.com
You can repeat the technique for each keyword.

Amazon API search results vs. Amazon.com search results

For our web app, which will use Amazon's API as a basis for some of the site's main interactions, we required the ability to do a generalized search of Amazon's products and return results based on relevancy. The expectation was that their API would work exactly like their actual site's search.
Unfortunately it does not. For instance, querying "joy of cooking" does not return a link to the famous cook book, but to some food processor. Contrarily, on the actual site, one would see the book isn't just first, but it and any derivations occupy the top 5 or so results.
Is there a way of getting this level of relevancy search from Amazon's API without specifying a node to browse through? We need to be able to search everything at once, and the API seems very limited on parameter sets.
The answer is that, if you use "All" as your sorting basis, rather than "Blended", you will get results that are inline with Amazon's own product search. Older docs don't seem to account for this discrepency, but testing both methods has shown "All" to be the preferred product sorting method.
http://docs.amazonwebservices.com/AWSECommerceService/2010-11-01/DG/
Pagesearch under "SearchIndex: All"
You don't get any item sorting options with this method, but if all you want is "most relevant" results, this is the preferred method.