Esempio n. 1
0
        private List <categorymembers> getCategoryTree(String categoryName)
        {
            string url            = urlWikipedia + categoryName + "&cmlimit=500&format=json&utf8=";
            var    webClient      = new WebClient();
            var    pageSourceCode = webClient.DownloadString(url);

            byte[]         bytes             = Encoding.Default.GetBytes(pageSourceCode);
            String         myString          = Encoding.UTF8.GetString(bytes);
            CategoriesList SubCategoriesList = JsonConvert.DeserializeObject <CategoriesList>(myString);

            return(SubCategoriesList.query.getCategorymembersList());
        }
Esempio n. 2
0
        private CategoriesList getSubCatgories(CategoriesList mainlistCategories)
        {
            categorymembers subCategori    = mainlistCategories.query.getRendomCategory();
            string          url            = urlWikipedia + subCategori.title + "&cmlimit=500&format=json&utf8=";
            var             webClient      = new WebClient();
            var             pageSourceCode = webClient.DownloadString(url);

            byte[]         bytes             = Encoding.Default.GetBytes(pageSourceCode);
            String         myString          = Encoding.UTF8.GetString(bytes);
            CategoriesList SubCategoriesList = JsonConvert.DeserializeObject <CategoriesList>(myString);

            return(SubCategoriesList);
        }
Esempio n. 3
0
        public void StartHistoryRendom(String title)
        {
            categoryList = new List <CategoryTree>();
            var    webClient = new WebClient();
            string url       = urlWikipedia + title + "&cmlimit=500&format=json&utf8=";

            var pageSourceCode = webClient.DownloadString(url);

            byte[]         bytes              = Encoding.Default.GetBytes(pageSourceCode);
            String         myString           = Encoding.UTF8.GetString(bytes);
            CategoriesList mainlistCategories = JsonConvert.DeserializeObject <CategoriesList>(myString);

            List <categorymembers> cm = mainlistCategories.query.getCategorymembersList();

            CategoryTree tr = new CategoryTree();

            tr.CatgoryName = title;
            tr.PagesList   = cm;
            categoryList.Add(tr);


            do
            {
                String categoryName = getRendomeCatgoryTitle(cm);
                if (categoryName.Equals("notfind"))
                {
                    break;
                }

                cm = getCategoryTree(categoryName);

                CategoryTree tree = new CategoryTree();
                tree.CatgoryName = categoryName;
                tree.PagesList   = cm;
                categoryList.Add(tree);
            } while (true);



            Pagename page = getRendomPage();

            startHtml(page);
        }