Esempio n. 1
0
        public List <Image> GetImagesOfVehicle(string subPageRaw, int maxImages)
        {
            string galleryRaw = Scrp.NodeCutter(subPageRaw, "<!-- Gallery -->", "</ul>");

            string[]     galleryRawImages = galleryRaw.Split(new string[] { "<li" }, StringSplitOptions.None);
            List <Image> images = new List <Image>();
            string       imUrl; int i = 1;

            foreach (string s in galleryRawImages)
            {
                if (i >= maxImages)
                {
                    break;
                }
                try
                {
                    i++;
                    imUrl = Scrp.NodeCutter(s, "src=", "alt=");
                    imUrl = imUrl.Replace("\"", "");
                    imUrl = imUrl.Replace("amp;", "");
                    if (imUrl.Substring(0, 1) == "/")
                    {
                        imUrl = imUrl.Remove(0, 1);
                    }
                    imUrl = URL + imUrl;
                    imUrl = imUrl.Replace("&wmk=&pfdrid_c=true", "");
                    images.Add(new Image(imUrl));
                }
                catch
                {
                    continue;
                }
            }
            return(images);
        }
Esempio n. 2
0
 public string GetTextFromSubPageBasedOnPanelBodyDiv(string subpageRaw, string startNode, string endNode)
 {
     try
     {
         string desc = Scrp.NodeCutter(subpageRaw, startNode, endNode);
         desc = Scrp.NodeCutter(desc, "<div class=\"panel-body\">", "</div>");
         return(desc);
     }
     catch
     {
         return("");
     }
 }
Esempio n. 3
0
        private Vehicle UpdateVehicleByExtras(Vehicle vhc)
        {
            string subPage = Scrp.GetPageTextRaw(vhc.Url);

            vhc.DateAuctionStart = DateTime.Now;
            vhc.DateAuctionEnd   = GetAuctionEndTime(subPage);
            vhc.InfoBasic        = GetEquipmenSeriesDescription(subPage);
            vhc.InfoExtra        = GetEquipmentOptionDescription(subPage);
            vhc.InfoDamage       = GetDamageDescription(subPage);
            vhc.InfoUsableParts  = GetUsableParts(subPage);
            vhc.IsDamaged        = vhc.InfoDamage != "";
            vhc.Images.AddRange(GetImagesOfVehicle(subPage, 25));
            return(vhc);
        }
Esempio n. 4
0
 public DateTime GetAuctionEndTime(string subpageRaw)
 {
     try
     {
         string endTimeRaw = Scrp.NodeCutter(subpageRaw, "data-seconds=", ">");
         endTimeRaw = endTimeRaw.Replace("\"", "");
         endTimeRaw = endTimeRaw.Replace("seconds=", "");
         return(DateTime.Now.AddSeconds(Int32.Parse(endTimeRaw)));
     }
     catch
     {
         throw new System.Exception("Cannot get auction end time");
     }
 }
Esempio n. 5
0
 public int GetExternalId(string carNode)
 {
     try
     {
         string idExt = Scrp.NodeCutter(carNode, "id\":\"", ",");
         idExt = idExt.Replace(":", "");
         idExt = idExt.Replace("\"", "");
         return(Convert.ToInt32(idExt));
     }
     catch
     {
         throw new System.Exception("Cannot get externall ID");
     }
 }
Esempio n. 6
0
        public Vehicle GetVehicleMainFromNode(string vehicleNode)
        {
            Vehicle vhc = new Vehicle();

            vhc.Title      = Scrp.NodeCutter(vehicleNode, "at\":\"", "\",\"");
            vhc.Url        = URL + Scrp.NodeCutter(vehicleNode, "au\":\"", "\",\"");
            vhc.IdExternal = GetExternalId(vehicleNode);
            Image imMini = new Image(URL.Substring(0, URL.Length - 1) + Scrp.NodeCutter(vehicleNode, "is\":\"", "\",\""));

            vhc.Images.Add(imMini);
            vhc.CompanyProvider = GetCompanyProviderDescription(vehicleNode);
            vhc.IsActive        = true;
            vhc.IsArchived      = false;
            return(vhc);
        }