Example #1
0
        //**************************MAP***********************////
        public string getDistance(string adresse1, string adresse2)
        {
            List <string> LatLng1 = new List <string>();
            List <string> LatLng2 = new List <string>();

            LatLng1 = DoctolibService.convertadd(adresse1);
            LatLng2 = DoctolibService.convertadd(adresse2);
            string dis1 = LatLng1[0] + "+" + LatLng1[1];
            string dis2 = LatLng2[0] + "+" + LatLng2[1];

            HtmlWeb      web = new HtmlWeb();
            HtmlDocument doc = web.Load("http://boulter.com/gps/distance/?from=" + dis1 + "&to=" + dis2 + "&units=k");

            return(DoctolibService.betweenStrings(doc.ParsedText, "</FONT></TD><TD>", " kilometers").Trim());
        }
Example #2
0
        public List <DoctolibDoctor> filterListDoctorsBySpecialityAndLocation(string speciality, string location, string availabilities)
        {
            List <string> listDisponibility = new List <string>();
            List <string> listLinkDoctors   = new List <string>();

            List <DoctolibDoctor> lst = new List <DoctolibDoctor>();

            if (location == null)
            {
                location = "france";
            }

            if (speciality == null)
            {
                speciality = "medecin-generaliste";
            }



            HtmlWeb      web = new HtmlWeb();
            HtmlDocument doc;

            try
            {
                doc = web.Load("https://www.doctolib.fr/" + speciality + "/" + location + "?availabilities=" + availabilities);
            }
            catch
            {
                try
                {
                    doc = web.Load("https://www.doctolib.fr/" + speciality + "/france?availabilities=" + availabilities);
                }
                catch
                {
                    try
                    {
                        doc = web.Load("https://www.doctolib.fr/medecin-generaliste/france?availabilities=" + availabilities);
                    }
                    catch
                    {
                        doc = web.Load("https://www.doctolib.fr/medecin-generaliste/france");
                    }
                }
            }
            listDisponibility.Add(DoctolibService.betweenStrings(doc.ParsedText.ToString(), "searchResultIds&quot;:[", "],&quot;availabilitiesLimit&"));
            listDisponibility.Add(DoctolibService.betweenStrings(doc.ParsedText.ToString(), ",&quot;specialityId&quot;:", ",&quot;title&quot;:"));
            listDisponibility.Add(availabilities);

            String[] searchresult         = listDisponibility[0].Split(',');
            List <DoctolibDoctor> doctors = new List <DoctolibDoctor>();

            for (int i = 0; i < searchresult.Length; i++)
            {
                var    json  = new WebClient().DownloadString("https://www.doctolib.fr/search_results/" + searchresult[i] + ".json?search_result_format=json&speciality_id=" + listDisponibility[1] + "&limit=" + listDisponibility[2] + "&availability_filter=true");
                string total = DoctolibService.betweenStrings(json, "\"total\":", ",\"");

                if (total != "0")
                {
                    string link    = DoctolibService.betweenStrings(json, ",\"link\":\"", "\",\"");
                    string address = DoctolibService.betweenStrings(json, ",\"address\":\"", "\",\"") + DoctolibService.betweenStrings(json, ",\"city\":\"", "\",\"");
                    string img     = "//res.cloudinary.com/doctolib/image/upload/w_160,h_160,c_fill,g_face/" + DoctolibService.betweenStrings(json, ",\"cloudinary_public_id\":\"", "\",\"") + ".jpg";
                    string lat     = DoctolibService.betweenStrings(json, "\"lat\":", ",\"");
                    string lng     = DoctolibService.betweenStrings(json, ",\"lng\":", "},\"");
                    string name    = DoctolibService.betweenStrings(json, ",\"name_with_title\":\"", "\",\"");


                    DoctolibDoctor doctor = new DoctolibDoctor()
                    {
                        name = name, img = img, address = address, lat = lat, lng = lng, path = link
                    };
                    lst.Add(doctor);
                }
            }


            return(lst);
        }