예제 #1
0
 public string GetPhotos()
 {
     var config = InstagramHelper.GetConfig();
     var authInfo = InstagramHelper.GetAuthInfo();
     var users = new InstaSharp.Endpoints.Users.Authenticated(config, authInfo);
     var result = users.Feed("self");
     return JsonConvert.SerializeObject(result);
 }
        public void GetPhotos()
        {
            InstagramController controller = new InstagramController();
            // Arrange
            var config = InstagramHelper.GetConfig();
            var authInfo = InstagramHelper.GetAuthInfo();
            var users = new InstaSharp.Endpoints.Users.Authenticated(config, authInfo);

            // Act
            var result = users.Feed("self");

            // Assert
        }
예제 #3
0
        public void saveRecentImages()
        {
            var users = new InstaSharp.Endpoints.Users.Authenticated(config, authInfo);
            var result = users.Feed(user_name);

            dynamic imagesList = JsonConvert.DeserializeObject(result.Json);

            string projectPath = Environment.CurrentDirectory;
            projectPath = projectPath.Substring(0, projectPath.Length - 9);
            
            var webClient = new WebClient();
            int count = 1;
            foreach (var data in imagesList.data)
            {
                string img_url = data.images.standard_resolution.url;
                System.Drawing.Image img = GetImageFromUrl(img_url);
                img.Save(projectPath + "Content/SleepScreen/Instagram/" + count + ".jpg");
                count++;
            }
            webClient.Dispose();
        }