コード例 #1
0
        public pageval GetPerson(int pageId)
        {
            WikiRequest request = new WikiRequest();

            request.PageId = pageId;
            WikiResponse response = GetResponseAsync(request).Result;

            if (response != null && response.query != null && response.query.pages != null)
            {
                return(response.query.pages.Values.FirstOrDefault());
            }
            return(null);
        }
コード例 #2
0
        public List <pageval> FindPeople(string term, int limit = 10, int offset = 0, bool living = true)
        {
            List <pageval> results = new List <pageval>();
            WikiRequest    request = new WikiRequest();

            request.SearchString = term;
            request.GetRevision  = false;
            WikiResponse response = GetResponseAsync(request).Result;

            if (response != null && response.query != null && response.query.pages != null)
            {
                results = response.query.pages.Values.ToList();
            }
            return(results);
            //return results;
            ///w/api.php?action=query&generator=search&gsrlimit=5&prop=pageimages|pageterms&pilimit=5&format=json&wbptterms=description&gsrsearch=hastemplate:Birth_date_and_age%20

            ///w/api.php?action=query&format=json&prop=pageimages%7Cpageterms&generator=search&redirects=1&formatversion=2&piprop=thumbnail&pithumbsize=50&pilimit=10&wbptterms=description&gpssearch=Albert+Ei&gpslimit=10
        }