Ejemplo n.º 1
0
 private void matchWikiIDWithWikiURL(WikipediaResponse wikiResponse)
 {
     foreach (KeyValuePair <string, Page> kvpage in wikiResponse.Query.Pages)
     {
         foreach (Film film in Results)
         {
             if (film.WikipediaId == kvpage.Value.PageId)
             {
                 film.WikipediaUrl = kvpage.Value.FullUrl;
             }
         }
     }
 }
Ejemplo n.º 2
0
        /*
         * Il json tendenzialmente per lui è tutto camelCase
         * altrimenti ci gira intorno
         */

        public string RequestWikipediaUrl( )
        {
            string ids = string.Empty;

            foreach (Film film in Results)
            {
                ids += String.Concat(film.WikipediaId, "|");
            }

            ids = ids.Substring(0, (ids.Length - 1));
            string standardLinkFormat = "https://en.wikipedia.org/w/api.php?action=query&prop=info&pageids={0}&inprop=url&format=json";

            standardLinkFormat = string.Format(standardLinkFormat, ids);

            WikipediaResponse wikiResponse = Utility.MakeRequest <WikipediaResponse>(standardLinkFormat, true);

            matchWikiIDWithWikiURL(wikiResponse);

            return(standardLinkFormat);
        }