rohanpillai20 / Wikipedia_Article_Count_Words

Query https://en.wikipedia.org/w/api.php?action=parse&section=0&prop=text&format=json&page=[topic] to get the [topic] Wikipedia article, and then count how many times the string [topic] appears in the article's text field.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wikipedia Article Count Words

Using an HTTP GET method, retrieve information from Wikipedia using a given topic. Query https://en.wikipedia.org/w/api.php?action=parse&section=0&prop=text&format=json&page=[topic] to get the topic Wikipedia article. Print the total number of times that the string topic appears in the article's text field.

Note: te search is case-sensitive.

The query response from the website is a JSON object described below:

  • parse: A JSON object representing the article's parsed web page. It has the following three fields:
    1. title: The article's title, as specified by the argument passed as topic
    2. pageid: The article's Page ID
    3. text: A JSON object that contains the Wikipedia article as an HTML dump

Example:

Input: pizza -> topic = 'pizza'

Output: 149 (this number might be incorrect, is just used as an example)

About

Query https://en.wikipedia.org/w/api.php?action=parse&section=0&prop=text&format=json&page=[topic] to get the [topic] Wikipedia article, and then count how many times the string [topic] appears in the article's text field.


Languages

Language:Java 100.0%