Beispiel #1
0
        public static List <clsPhone> CheckPrice(string SearchName)
        {
            var iList = new List <clsPhone>();

            //http://www.gumtree.com.au/s-mobile-phones/box-hill-melbourne/iphone+5/k0c18597l3001721r500?sort=price_desc&ad=offering&price-type=fixed
            SearchName = SearchName.Replace(" ", "+");
            System.Net.WebClient client = new WebClient();
            //client.Headers.Add("user-agent", "Android 5.0");
            byte[] page =
                client.DownloadData("http://www.gumtree.com.au/s-mobile-phones/box-hill-melbourne/" + SearchName +
                                    "/k0c18597l3001721r500?sort=price_desc&ad=offering&price-type=fixed");
            string content = System.Text.Encoding.UTF8.GetString(page);

            content =
                Regex.Match(content, "<ul id=\"srchrslt-adtable\".*<div class=\"rs-paginator rounded-bottom-corners3\">",
                            RegexOptions.Singleline).Value;

            Regex regexObj     = new Regex("class=\"rs-ad-title h-elips\" href=.*?</a>", RegexOptions.Singleline);
            Regex regexObj2    = new Regex("<div class=\"h-elips \">.*?</div>", RegexOptions.Singleline);
            Match matchResult  = regexObj.Match(content);
            Match matchResult2 = regexObj2.Match(content);

            int i = 0;

            while (matchResult.Success && matchResult2.Success && i < 8)
            {
                var iTemp = new OZPhoneDetail.clsPhone
                {
                    PhoneName = matchResult.Value.Replace("class=\"rs-ad-title h-elips\" href=", "")
                };

                //alt="iPhone 4S 64GB" /></a>
                iTemp.PhoneName = iTemp.PhoneName.Replace("</a>", "");
                var iTempArr = iTemp.PhoneName.Split('>');
                iTemp.PhoneName   = iTempArr[1];
                iTemp.PhonePrice  = matchResult2.Value.Replace("<div class=\"h-elips \">", "");
                iTemp.PhonePrice  = iTemp.PhonePrice.Replace("</div>", "").Trim().Replace("$", "").Replace(",", "");
                iTemp.PhoneSource = "GumTree";

                try
                {
                    Convert.ToDouble(iTemp.PhonePrice);
                    iList.Add(iTemp);
                }
                catch
                {
                }

                i++;
                matchResult  = matchResult.NextMatch();
                matchResult2 = matchResult2.NextMatch();
            }

            return(iList);
        }
Beispiel #2
0
        public static List <clsPhone> CheckPrice(string SearchName)
        {
            var iList = new List <clsPhone>();

            //http://www.ebay.com.au/sch/Mobile-Phones-/9355/i.html?_sop=15&Carrier=Unlocked&_from=R40&_dmpt=AU_Mobile_Phones&_nkw=Iphone%205&LH_PrefLoc=1&rt=nc&LH_BIN=1
            SearchName = SearchName.Replace(" ", "+");
            var client = new WebClient();

            client.Headers.Add("user-agent", "Android 5.0");
            byte[] page =
                client.DownloadData(
                    "http://www.ebay.com.au/sch/Mobile-Phones-/9355/i.html?_sop=15&Carrier=Unlocked&_from=R40&_dmpt=AU_Mobile_Phones&_nkw=" +
                    SearchName + "&LH_PrefLoc=1&rt=nc&LH_BIN=1");
            string content = System.Text.Encoding.UTF8.GetString(page);

            content =
                Regex.Match(content, "<div id=\"ResultSetItems.*<div class=\"topRatedContent g-hdn\">",
                            RegexOptions.Singleline).Value;

            Regex regexObj     = new Regex("itemprop=\"name\">.*?</a>", RegexOptions.Singleline);
            Regex regexObj2    = new Regex("<div  class=\"g-b\" itemprop=\"price\">.*?</div>", RegexOptions.Singleline);
            Match matchResult  = regexObj.Match(content);
            Match matchResult2 = regexObj2.Match(content);

            int i = 0;

            while (matchResult.Success && matchResult2.Success && i < 9)
            {
                var iTemp = new OZPhoneDetail.clsPhone {
                    PhoneName = matchResult.Value.Replace("itemprop=\"name\">", "")
                };

                //alt="iPhone 4S 64GB" /></a>
                iTemp.PhoneName   = iTemp.PhoneName.Replace("</a>", "");
                iTemp.PhonePrice  = matchResult2.Value.Replace("<div  class=\"g-b\" itemprop=\"price\">", "");
                iTemp.PhonePrice  = iTemp.PhonePrice.Replace("</div>", "").Replace("AU $", "");
                iTemp.PhoneSource = "Ebay";
                iList.Add(iTemp);
                i++;
                matchResult  = matchResult.NextMatch();
                matchResult2 = matchResult2.NextMatch();
            }

            return(iList);
        }
Beispiel #3
0
        public static List <clsPhone> CheckPrice(string SearchName)
        {
            var iList = new List <clsPhone>();

            //http://www.kogan.com/au/search/?keywords=HTC%208X&department=phones
            //SearchName = SearchName.Replace(" ", "+");

            System.Net.WebClient client = new WebClient();
            client.Headers.Add("user-agent", "Android 5.0");
            byte[] page =
                client.DownloadData("http://www.kogan.com/au/search/?keywords=" + SearchName + "&department=phones");
            string content = System.Text.Encoding.UTF8.GetString(page);

            content =
                Regex.Match(content, "class=\"products list-view one-column graduated-border.*id=\"product-list-end\"",
                            RegexOptions.Singleline).Value;
            //class="products list-view one-column graduated-border
            //id="product-list-end"

            Regex regexObj     = new Regex("itemprop=\"url\">.*?</a></h3>", RegexOptions.Singleline);
            Regex regexObj2    = new Regex("<li itemprop=\"price\">.*?</li>", RegexOptions.Singleline);
            Match matchResult  = regexObj.Match(content);
            Match matchResult2 = regexObj2.Match(content);

            int i = 0;

            while (matchResult.Success && matchResult2.Success && i < 4)
            {
                var iTemp = new OZPhoneDetail.clsPhone {
                    PhoneName = matchResult.Value.Replace("itemprop=\"url\">", "")
                };

                //alt="iPhone 4S 64GB" /></a>
                iTemp.PhoneName   = iTemp.PhoneName.Replace("</a></h3>", "");
                iTemp.PhonePrice  = matchResult2.Value.Replace("<li itemprop=\"price\">", "");
                iTemp.PhonePrice  = iTemp.PhonePrice.Replace("</li>", "").Replace("$", "");
                iTemp.PhoneSource = "Kogan";
                iList.Add(iTemp);
                i++;
                matchResult  = matchResult.NextMatch();
                matchResult2 = matchResult2.NextMatch();
            }

            return(iList);
        }
Beispiel #4
0
        public static List <clsPhone> CheckPrice(string SearchName)
        {
            //http://www.mobicity.com.au/catalogsearch/result/?q=iphone+4s+16
            //http://www.mobicity.com.au/catalogsearch/result/?product_type=115&q=iphone+4s+16
            var iList = new List <clsPhone>();

            SearchName = SearchName.Replace(" ", "+");

            System.Net.WebClient client = new WebClient();
            client.Headers.Add("user-agent", "Android 5.0");
            byte[] page =
                client.DownloadData("http://www.mobicity.com.au/catalogsearch/result/?product_type=115&q=" + SearchName);
            string content = System.Text.Encoding.UTF8.GetString(page);

            content =
                Regex.Match(content, "<ul class=\"products-grid\">.*<div class=\"clearfix\"></div>",
                            RegexOptions.Singleline).Value;

            Regex regexObj     = new Regex("alt=\".*? /></a>", RegexOptions.Singleline);
            Regex regexObj2    = new Regex("<div class=\"price\">.*?</div>", RegexOptions.Singleline);
            Match matchResult  = regexObj.Match(content);
            Match matchResult2 = regexObj2.Match(content);


            while (matchResult.Success && matchResult2.Success)
            {
                var iTemp = new OZPhoneDetail.clsPhone {
                    PhoneName = matchResult.Value.Replace("alt=\"", "")
                };

                //alt="iPhone 4S 64GB" /></a>
                iTemp.PhoneName   = iTemp.PhoneName.Replace("\" /></a>", "");
                iTemp.PhonePrice  = matchResult2.Value.Replace("<div class=\"price\">", "");
                iTemp.PhonePrice  = iTemp.PhonePrice.Replace("</div>", "").Trim().Replace("$", "");
                iTemp.PhoneSource = "MobiCity";
                iList.Add(iTemp);

                matchResult  = matchResult.NextMatch();
                matchResult2 = matchResult2.NextMatch();
            }


            return(iList);
        }
Beispiel #5
0
        public static List <clsPhone> CheckPrice(string SearchName)
        {
            var iList = new List <clsPhone>();

            //http://www.mobileciti.com.au/catalogsearch/result/?q=HTC+8X&search=Submit&order=price&dir=desc
            SearchName = SearchName.Replace(" ", "+");

            System.Net.WebClient client = new WebClient();
            client.Headers.Add("user-agent", "Android 5.0");
            byte[] page =
                client.DownloadData("http://www.mobileciti.com.au/catalogsearch/result/?q=" + SearchName +
                                    "&search=Submit&order=price&dir=desc");
            string content = System.Text.Encoding.UTF8.GetString(page);

            content =
                Regex.Match(content, "<li class=\"item first\">.*?<div class=\"toolbar-bottom\">",
                            RegexOptions.Singleline).Value;

            Regex regexObj     = new Regex("title=\".*?\" class=\"product-image\">");
            Regex regexObj2    = new Regex("<span class=\"price\">.*?</span>");
            Match matchResult  = regexObj.Match(content);
            Match matchResult2 = regexObj2.Match(content);


            while (matchResult.Success && matchResult2.Success)
            {
                var iTemp = new OZPhoneDetail.clsPhone {
                    PhoneName = matchResult.Value.Replace("title=\"", "")
                };

                //alt="iPhone 4S 64GB" /></a>
                iTemp.PhoneName   = iTemp.PhoneName.Replace("\" class=\"product-image\">", "");
                iTemp.PhonePrice  = matchResult2.Value.Replace("<span class=\"price\">", "");
                iTemp.PhonePrice  = iTemp.PhonePrice.Replace("</span>", "").Trim().Replace("$", "");
                iTemp.PhoneSource = "MobileCiti";
                iList.Add(iTemp);

                matchResult  = matchResult.NextMatch();
                matchResult2 = matchResult2.NextMatch();
            }

            return(iList);
        }