예제 #1
0
        public override async Task ExecuteAsync(string generator, WebHookHandlerContext context)
        {
            // Get the WebHook client
            InstagramWebHookClient client = Dependencies.Client;

            // Convert the incoming data to a collection of InstagramNotifications
            var notifications = context.GetDataOrDefault <IEnumerable <InstagramNotification> >();

            foreach (var notification in notifications)
            {
                // Use WebHook client to get detailed information about the posted media
                var entries = await client.GetRecentGeoMedia(context.Id, notification.ObjectId);

                foreach (JToken entry in entries)
                {
                    // Get direct links and sizes of media
                    var thumbnail = entry["images"]["thumbnail"].ToObject <InstagramMedia>();
                    var lowres    = entry["images"]["low_resolution"].ToObject <InstagramMedia>();
                    var std       = entry["images"]["standard_resolution"].ToObject <InstagramMedia>();
                }
            }
        }
예제 #2
0
        public override async Task ExecuteAsync(string generator, WebHookHandlerContext context)
        {
            // Get the WebHook client
            InstagramWebHookClient client = Dependencies.Client;

            // Convert the incoming data to a collection of InstagramNotifications
            var notifications = context.GetDataOrDefault <InstagramNotificationCollection>();

            foreach (var notification in notifications)
            {
                // Use WebHook client to get detailed information about the posted media
                JArray entries = await client.GetRecentGeoMedia(context.Id, notification.ObjectId);

                foreach (JToken entry in entries)
                {
                    InstagramPost post = entry.ToObject <InstagramPost>();

                    // Image information
                    if (post.Images != null)
                    {
                        InstagramMedia thumbnail = post.Images.Thumbnail;
                        InstagramMedia lowRes    = post.Images.LowResolution;
                        InstagramMedia stdRes    = post.Images.StandardResolution;
                    }

                    // Video information
                    if (post.Videos != null)
                    {
                        InstagramMedia lowBandwidth = post.Videos.LowBandwidth;
                        InstagramMedia lowRes       = post.Videos.LowResolution;
                        InstagramMedia stdRes       = post.Videos.StandardResolution;
                    }

                    // Get direct links and sizes of media
                    Uri link = post.Link;
                }
            }
        }