Exemple #1
0
        public static List <string> GetAllGridsRawContentFromForum(string iURL, CookieCollection iLogCookies)
        {
            CookieCollection oCookies = new CookieCollection();
            HttpStatusCode   oCode    = HttpStatusCode.NotFound;

            HtmlDocument answer = Service_Misc.GetWebPageFromRequest("GET " + iURL + " HTTP/1.1|Host: miqobot.com|Connection: keep-alive|Cache-Control: max-age=0|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Sec-Fetch-Mode: navigate|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3|Sec-Fetch-Site: same-origin|Referer: https://miqobot.com/forum/wp-login.php?redirect_to=https%3A%2F%2Fmiqobot.com%2Fforum%2Fforums%2Ftopic%2Fgrade-1-carbonized-matter-min-lv20%2F|Accept-Encoding: gzip, deflate, br|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|",
                                                                     iLogCookies, ref oCookies, ref oCode);

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

            List <string>   attachmentsList        = new List <string>();
            List <HtmlNode> listAllAttachmentsNode = answer.DocumentNode.Descendants("div").ToList();

            foreach (HtmlNode node in listAllAttachmentsNode)
            {
                if (node.GetAttributeValue("class", "") == "bbp-attachments")
                {
                    attachmentsList.Add(Service_Misc.ExtractLink(node));
                }
            }

            List <string> listGrids = new List <string>();

            foreach (string attachmentLink in attachmentsList)
            {
                string gridRawContent = Service_Misc.GetContentFromRequest("GET " + attachmentLink + " HTTP/1.1|Host: miqobot.com|Connection: keep-alive|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Sec-Fetch-Mode: navigate|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3|Sec-Fetch-Site: same-origin|Referer: https://miqobot.com/forum/forums/topic/grade-1-carbonized-matter-min-lv20/|Accept-Encoding: gzip, deflate, br|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|",
                                                                           iLogCookies, ref oCookies, ref oCode);

                listGrids.Add(gridRawContent);
            }
            return(listGrids);
        }
Exemple #2
0
        public static string GetLastGrid(string iItemName, CookieCollection iLogCookies, MiqoItemPage iPage, out string oGridName)
        {
            string gridItemName = iItemName + " Grid";

            oGridName = "";
            CookieCollection oCookies = new CookieCollection();
            HttpStatusCode   oCode    = HttpStatusCode.NotFound;

            //Looking into cache directory
            DirectoryInfo exeDirectory   = new DirectoryInfo(Service_Misc.GetExecutionPath());
            DirectoryInfo cacheDirectory = new DirectoryInfo(Path.Combine(exeDirectory.FullName, "CacheGrid"));

            if (!cacheDirectory.Exists)
            {
                cacheDirectory.Create();
            }

            string   gridRawContent = "";
            FileInfo cacheGridFile  = new FileInfo(Path.Combine(cacheDirectory.FullName, gridItemName + ".txt"));

            if (cacheGridFile.Exists)
            {
                oGridName      = gridItemName;
                gridRawContent = System.IO.File.ReadAllText(cacheGridFile.FullName);
            }
            else
            {
                HtmlDocument answer = Service_Misc.GetWebPageFromRequest("GET " + iPage.URL + " HTTP/1.1|Host: miqobot.com|Connection: keep-alive|Cache-Control: max-age=0|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Sec-Fetch-Mode: navigate|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3|Sec-Fetch-Site: same-origin|Referer: https://miqobot.com/forum/wp-login.php?redirect_to=https%3A%2F%2Fmiqobot.com%2Fforum%2Fforums%2Ftopic%2Fgrade-1-carbonized-matter-min-lv20%2F|Accept-Encoding: gzip, deflate, br|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|",
                                                                         iLogCookies, ref oCookies, ref oCode);
                if (null == answer)
                {
                    return(null);
                }

                string          lastUrlAttachment      = "";
                List <HtmlNode> listAllAttachmentsNode = answer.DocumentNode.Descendants("div").ToList();
                foreach (HtmlNode node in listAllAttachmentsNode)
                {
                    if (node.GetAttributeValue("class", "") == "bbp-attachments")
                    {
                        lastUrlAttachment = Service_Misc.ExtractLink(node);
                    }
                }

                gridRawContent = Service_Misc.GetContentFromRequest("GET " + lastUrlAttachment + " HTTP/1.1|Host: miqobot.com|Connection: keep-alive|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36|Sec-Fetch-Mode: navigate|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3|Sec-Fetch-Site: same-origin|Referer: https://miqobot.com/forum/forums/topic/grade-1-carbonized-matter-min-lv20/|Accept-Encoding: gzip, deflate, br|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|",
                                                                    iLogCookies, ref oCookies, ref oCode);
            }

            return(GetGridFromRawContent(iItemName, gridRawContent, out oGridName));
        }
Exemple #3
0
        /// <summary>
        /// Retrieves all aetheryte names and positions from https://ffxiv.consolegameswiki.com/wiki/Zone
        /// </summary>
        /// <returns></returns>
        public static List <FFXIVAetheryte> GetAetherytes()
        {
            List <FFXIVAetheryte> result = new List <FFXIVAetheryte>();

            //Main zone page
            CookieCollection oCookies = new CookieCollection();
            HttpStatusCode   oCode    = HttpStatusCode.NotFound;
            HtmlDocument     answer   = Service_Misc.GetWebPageFromRequest("GET https://ffxiv.consolegameswiki.com/wiki/Zone HTTP/1.1|Host: ffxiv.consolegameswiki.com|Connection: keep-alive|Pragma: no-cache|Cache-Control: no-cache|Upgrade-Insecure-Requests: 1|User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36|Sec-Fetch-User: ?1|Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9|Sec-Fetch-Site: same-origin|Sec-Fetch-Mode: navigate|Referer: https://ffxiv.consolegameswiki.com/wiki/FF14_Wiki|Accept-Encoding: gzip, deflate|Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7|Cookie: __cfduid=d64998d831d683525635413f445baf9671577745615; _ga=GA1.2.147161069.1577745617; _gid=GA1.2.132489683.1577745617; trc_cookie_storage=taboola%2520global%253Auser-id%3D8ee6f8c7-39f8-4db7-b620-5868e971d900-tuct4ec3105||",
                                                                           oCookies, ref oCookies, ref oCode);

            if (null == answer)
            {
                return(result);
            }

            HtmlNode contentNode = answer.GetElementbyId("mw-content-text");

            if (null == contentNode)
            {
                return(result);
            }

            string currentRegion = "Unknown";

            foreach (HtmlNode childNode in contentNode.ChildNodes)
            {
                if (childNode.Name == "h3")
                {
                    currentRegion = childNode.InnerText.Trim();
                }
                else if (childNode.Name == "ul")
                {
                    foreach (HtmlNode liNode in childNode.ChildNodes)
                    {
                        foreach (HtmlNode aNode in liNode.ChildNodes)
                        {
                            if (aNode.Name != "a")
                            {
                                continue;
                            }

                            string link = Service_Misc.ExtractLink(aNode);
                            result.AddRange(GetAetherytesFromRegion(currentRegion, aNode.InnerText.Trim(), link));
                        }
                    }
                }
            }

            return(result);
        }