示例#1
0
        public async Task <WikiCityData> GetPopulationFallback(City city)
        {
            int pageId = await this.GetWikiPageId(city);

            var wikiPage = await this.GetWikiPage(pageId);

            if (wikiPage == null)
            {
                return(null);
            }

            WikiCityData wikiData = new WikiCityData();

            wikiData.population = processData.MatchPopulation(wikiPage);
            wikiData.wikiRef    = $"{this.wikiUrl}?curid={pageId}";
            return(wikiData);
        }
示例#2
0
        public async Task <WikiCityData> GetWikiCityData(City city)
        {
            WikiCityData wikiData = new WikiCityData();
            int          pageId   = await this.GetWikiPageId(city);

            var wikiPage = await this.GetWikiPage(pageId);

            if (wikiPage == null)
            {
                wikiData.area    = 0;
                wikiData.summary = null;
            }
            else
            {
                wikiData.area    = processData.MatchArea(wikiPage);
                wikiData.summary = processData.MatchSummary(wikiPage);
                wikiData.wikiRef = $"{this.wikiUrl}?curid={pageId}";
            }

            return(wikiData);
        }