Example #1
0
        public static string GetPageAsString(Uri address)
        {
            string result = "";

            // Create the web request
            HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;


            //// Get response
            using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
            {
                // Get the response stream
                StreamReader         reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.ASCII);
                JavaScriptSerializer js     = new JavaScriptSerializer();

                // Read the whole contents and return as a string
                result = reader.ReadToEnd();
                // Convert to UserProfile
                Profile.UserProfile userprofile = (Profile.UserProfile)js.Deserialize(result, typeof(Profile.UserProfile));
            };

            return(result);
        }
Example #2
0
        public void GetInfo(string session_id, SearchProfiles.Item user)
        {
            try
            {
                HttpRequest req = new HttpRequest();
                req["x-api-key"]               = "M0iGVpi2C4MZGdYSGYQDx5Oy3pts6SJa";
                req[HttpHeader.Accept]         = "application/json";
                req[HttpHeader.AcceptCharset]  = "utf-8";
                req[HttpHeader.AcceptLanguage] = "en";
                req.UserAgent       = "PlanetRomeo/1000000536 Android/5.1.1 (samsung; SM-G930L)";
                req["x-session-id"] = session_id;
                Profile.UserProfile userProfile = JsonConvert.DeserializeObject <Profile.UserProfile>(req.Get($"https://pradn.net/v4/profiles/{user.id}/full?expand=partner%2Cshared_album_grant_status%2Calbums%2Cbed_and_breakfast").ToString());
                lock (this)
                {
                    Program.people.Add(userProfile);
                }
                if (!Directory.Exists($"Parser\\{userProfile.location.country}"))
                {
                    Directory.CreateDirectory($"Parser\\{userProfile.location.country}");
                }
                if (!Directory.Exists($"Parser\\{userProfile.location.country}\\{userProfile.location.name}"))
                {
                    Directory.CreateDirectory($"Parser\\{userProfile.location.country}\\{userProfile.location.name}");
                }
                if (!Directory.Exists($"Parser\\{userProfile.location.country}\\{userProfile.location.name}\\{userProfile.id}"))
                {
                    Directory.CreateDirectory($"Parser\\{userProfile.location.country}\\{userProfile.location.name}\\{userProfile.id}");
                }
                if (!Directory.Exists($"Parser\\{userProfile.location.country}\\{userProfile.location.name}\\{userProfile.id}\\Photos"))
                {
                    Directory.CreateDirectory($"Parser\\{userProfile.location.country}\\{userProfile.location.name}\\{userProfile.id}\\Photos");
                }
                File.WriteAllText($"Parser\\{userProfile.location.country}\\{userProfile.location.name}\\{userProfile.id}\\UserData.json", JsonConvert.SerializeObject(userProfile) + "\r\n");
                File.WriteAllText($"Parser\\{userProfile.location.country}\\{userProfile.location.name}\\{userProfile.id}\\HeadLine.txt", userProfile.headline + "\r\n");
                File.AppendAllText($"Parser\\UserData.json", JsonConvert.SerializeObject(userProfile) + "\r\n");
                File.AppendAllText($"Parser\\HeadLine.txt", userProfile.headline + "\r\n"); File.AppendAllText($"Parser\\UserData.json", JsonConvert.SerializeObject(userProfile) + "\r\n");
                File.AppendAllText($"Parser\\{ userProfile.location.country}\\HeadLine.txt", userProfile.headline + "\r\n");

                try
                {
                    req.Raw(xNet.HttpMethod.PUT, $"https://pradn.net/v4/profiles/{user.id}/footprint", new StringContent("{\"footprint_id\":\"205\"}")
                    {
                        ContentType = "application/json"
                    });
                    Messages.SendMesage mess = new Messages.SendMesage(user.id, $"Hi, {user.name}! If you really looking for gay, Join to world's biggest gay club - https://bigosx.com club! A lot of gays from {user.location.name}. Membership is free!");
                    Console.WriteLine("\t\t" + req.Post("https://pradn.net/v4/messages", JsonConvert.SerializeObject(mess), "application/json; charset=utf-8"));
                    Thread.Sleep(2000);
                    foreach (var album in userProfile.albums)
                    {
                        if (album.items != null)
                        {
                            foreach (var i in album.items)
                            {
                                try
                                {
                                    HttpRequest req1 = new HttpRequest();
                                    req1.Get($"https://pradn.net/img/usr/original/1x1/{i.url_token}.jpg").ToFile($"Parser\\{userProfile.location.country}\\{userProfile.location.name}\\{userProfile.id}\\Photos\\{i.url_token}.jpg");
                                    req1.Get($"https://pradn.net/img/usr/original/1x1/{i.url_token}.jpg").ToFile($"Parser\\Photos\\{i.url_token}.jpg");
                                    req.Get($"https://pradn.net/v4/%2Freactions%2Fpictures%2Fbasic%2F/summary?element_id={i.id}&value=LIKE");
                                    ProfileWork.SendLike sendLike = new ProfileWork.SendLike("LIKE", i.id);
                                    //req.Post($"https://pradn.net/v4/%2Freactions%2Fpictures%2Fbasic%2F?element_id={i.id}", JsonConvert.SerializeObject(sendLike), "application/json; charset=utf-8");


                                    break;
                                }
                                catch { }
                                finally { }
                            }
                        }
                    }
                }
                catch { }
            }
            catch { }
        }
Example #3
0
 // GET /api/Values/?id=1&pwd=test
 public Profile.UserProfile Get(string id, string pwd)
 {
     Profile.UserProfile myprofile = new Profile.UserProfile();
     //return "Success retrieval of an ID.";
     return(myprofile);
 }