/// <summary> /// Initializes a new instance of the <see cref="App" /> class. /// </summary> public App() { Instagram = new InstagramService(); InitializeComponent(); MainPage = GetMainPage(); }
private List <InstagramMedia> GetFeedDataFromInstagram() { var service = InstagramService.CreateFromAccessToken(siteSettingsHelper.GetCurrentSiteInstagramAccessToken()); var userResponse = service.Users.GetSelf(); // Temporary list for storing the retrieved media var media = new List <InstagramMedia>(); // Find the first user with the specified username var user = userResponse.Body.Data; if (user != null) { // Declare the initial search options var options = new InstagramUserRecentMediaOptions { Count = siteSettingsHelper.GetCurrentSiteInstagramMaxItems(), }; var mediaResponse = service.Users.GetRecentMedia(user.Id, options); // Add the media to the list media.AddRange(mediaResponse.Body.Data); } CacheManager.Add( GetCacheKey(), media, CacheItemPriority.Normal, null, new AbsoluteTime(TimeSpan.FromMinutes(siteSettingsHelper.GetCurrentSiteInstagramExpiration()))); return(media); }
private List <InstagramMedia> GetFeedDataFromInstagram() { var service = InstagramService.CreateFromAccessToken(instagramConfig.AccessToken); var userResponse = service.Users.Search(Username); // Temporary list for storing the retrieved media var media = new List <InstagramMedia>(); // Find the first user with the specified username var user = userResponse.Body.Data.FirstOrDefault(x => x.Username == Username); if (user != null) { // Declare the initial search options var options = new InstagramUserRecentMediaOptions { Count = instagramConfig.MaxItems, }; var mediaResponse = service.Users.GetRecentMedia(user.Id, options); // Add the media to the list media.AddRange(mediaResponse.Body.Data); } CacheManager.Add( GetCacheKey(), media, CacheItemPriority.Normal, null, new AbsoluteTime(TimeSpan.FromMinutes(instagramConfig.Expiration))); return(media); }
private void InitService() { try { Service = new InstagramService(); } catch (global::System.InvalidOperationException) { } }
private async void Load() { var result = await InstagramService.LoadSession(); if (result != null) { MainPage = new NavigationPage(new HomeView()); } else { MainPage = new NavigationPage(new MainView()); } }
static void Main(string[] args) { var accountData = new UserInformation { Username = "", Password = "" }; var instagramService = new InstagramService(accountData); if (instagramService.IsAuthenticated) { } }
protected void load_instagram_data() { try { SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString); SqlDataReader dr; SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select instagramtoken,instagramid from tbl_ext_creds_instagram (nolock) where userid='" + Session["username"].ToString() + "'"; cmd.Connection = conn; conn.Open(); if (conn.State == ConnectionState.Open) { dr = cmd.ExecuteReader(); dr.Read(); if (dr.HasRows) { Session["instagram_token"] = dr[0].ToString(); Session["instagram_id"] = dr[1].ToString(); InstagramService instagram = InstagramService.CreateFromAccessToken(Session["instagram_token"].ToString()); var recent = instagram.Users.GetRecentMedia(); instapics.InnerHtml = "<ul>"; foreach (var media in recent.Body.Data) { var value = media; instapics.InnerHtml = instapics.InnerHtml + "<li><a href='" + media.Images.StandardResolution.Url + "'><img class=\"thumbnails\" src='" + media.Images.LowResolution.Url + "'/></a></li><br>"; //$(".instapics").append("<li><a target='_blank' href='" + data.data[i].link + "'><img class=\"thumbnails\" src='" + data.data[i].images.low_resolution.url + "'></img></a></li><br>"); } instapics.InnerHtml = instapics.InnerHtml + "</ul>"; //ScriptManager.RegisterClientScriptBlock(this, typeof(System.Web.UI.Page), "renderinstagramdata", "renderData('"+dr[0].ToString()+"',null,null);", true); //ScriptManager.RegisterClientScriptBlock(this.Page, Page.GetType(), "loadinstagramdata", "<script type=\"text/javascript\">alert('hello');</script>", false); //string script = "alert('hello');"; //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clentscript", script, true); } else { Session["instagram_token"] = null; Session["instagram_id"] = null; } dr.Close(); } conn.Close(); } catch (Exception Ex) { throw Ex; } }
async Task Load() { var userInfo = DetailsPopupView.user; IsVerified = userInfo.Value.IsVerified; UserName = userInfo.Value.Username.ToString(); FullName = userInfo.Value.FullName.ToString(); Biography = userInfo.Value.Biography.ToString(); MediaCount = userInfo.Value.MediaCount.ToString(); ExternalUrl = userInfo.Value.ExternalUrl.ToString(); ProfilePicUrl = userInfo.Value.ProfilePicUrl.ToString(); FollowerCount = InstagramService.UserCountFormat(userInfo.Value.FollowerCount); FollowingCount = InstagramService.UserCountFormat(userInfo.Value.FollowingCount); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Main form = new Main(); IMainService mainService = new MainService(); IMessageService messageService = new MessageService(); IVkService vkService = new VkService(); IInstagramService instagramService = new InstagramService(); MainPresenter presenter = new MainPresenter(form, instagramService, mainService, vkService, messageService); Application.Run(form); }
public static IEnumerable <InstagramMedia> GetLastestInstagramPosts(object OAuthValue) { // Check whether the OAuth data is valid InstagramOAuthData instagram = OAuthValue as InstagramOAuthData; // Check whether the OAuth data is valid if (instagram != null && instagram.IsValid) { // Gets an instance of TwitterService based on the OAuth data InstagramService service = instagram.GetService(); var response = service.Users.GetRecentMedia(); // Get recent status messages (tweets) from the authenticated user return(response.Body.Data); } return(null); }
public static async Task ProcessMethod(TextWriter log) { string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString"); QueueClient client = QueueClient.CreateFromConnectionString(connectionString, "sociolroom"); DateTime createdDateTime = DateTime.MinValue; while (true) { try { var grams = await InstagramService.GetPhoto(Config.Tag); grams = grams.OrderBy(c => c.CreatedAt).ToList(); List <BrokeredMessage> toSend = new List <BrokeredMessage>(); foreach (var gram in grams) { if (gram.CreatedAt > createdDateTime) { SocialAnalytics analytics = new SocialAnalytics { SocialNetwork = SocialNetwork.Instagram, Id = gram.Id, CreatedAt = gram.CreatedAt, CreatedAtTimeStamp = gram.CreatedAt.Ticks, From = gram.User, Tags = gram.Tags, ImageUrl = gram.ImageUrl }; toSend.Add(new BrokeredMessage(analytics)); createdDateTime = gram.CreatedAt; } } await client.SendBatchAsync(toSend); } catch (Exception ex) { log.WriteLine(DateTime.UtcNow + " -- InstagramListener: " + ex.Message); } await Task.Delay(TimeSpan.FromMinutes(3)); } }
public string getInstagram(string user) { try { SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString); SqlDataReader dr; SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select instagramtoken,instagramid from tbl_ext_creds_instagram (nolock) where userid='" + user + "'"; cmd.Connection = conn; conn.Open(); if (conn.State == ConnectionState.Open) { dr = cmd.ExecuteReader(); dr.Read(); if (dr.HasRows) { //Session["instagram_token"] = dr[0].ToString(); //Session["instagram_id"] = dr[1].ToString(); //ScriptManager.RegisterClientScriptBlock(Page, typeof(System.Web.UI.Page), "loadinstagramdata", "getData('" + dr[0].ToString() + "',null,null);", true); InstagramService instagram = InstagramService.CreateFromAccessToken(dr[0].ToString()); var recent = instagram.Users.GetRecentMedia(); instagramdata = recent.Response.Body.ToString(); } //else //{ // Session["instagram_token"] = null; // Session["instagram_id"] = null; //} dr.Close(); } conn.Close(); } catch (Exception Ex) { throw Ex; } //if (instagramdata == string.Empty) // instagramdata = "User not found"; return(instagramdata); }
static void Main(string[] args) { Console.WriteLine("Crawler Start...."); #region Youtube API 호출 Console.WriteLine("Youtube Crawling Start...."); YoutubeService youtubeService = new YoutubeService(); List <string> channelIDList = AppConfiguration.YoutubeChannelId.Split(";").ToList(); int loopCount = AppConfiguration.YoutubeLoopCount; List <string> videoIdList = youtubeService.SetVideoListInChannel(channelIDList, loopCount); youtubeService.SetInfoInVideoList(videoIdList); Console.WriteLine("Youtube Crawling End!"); #endregion #region Twitter API 호출 Console.WriteLine("Twitter Crawling Start...."); TwitterService twitterService = new TwitterService(); List <string> twitterIDList = twitterService.GetTwitterIdList(); twitterService.SetTwitterDataByIds(twitterIDList); Console.WriteLine("Twitter Crawling End!"); #endregion #region Instagram API 호출 Console.WriteLine("Instagram Crawling Start...."); InstagramService instagramService = new InstagramService(); List <string> userNameList = AppConfiguration.InstagramUserNameList.Split(";").ToList(); instagramService.SetMediaListByUserName(userNameList); Console.WriteLine("Instagram Crawling End!"); #endregion Console.ReadKey(); }
protected void Instabutton_Click(object sender, EventArgs e) { if (Session["instagram_token"] == null || Session["instagram_id"] == null) { var client_id = ConfigurationManager.AppSettings["instagram.clientid"].ToString(); var redirect_uri = ConfigurationManager.AppSettings["instagram.redirecturi"].ToString(); Response.Redirect("https://api.instagram.com/oauth/authorize/?client_id=" + client_id + "&redirect_uri=" + redirect_uri + "&response_type=code"); } else { InstagramService instagram = InstagramService.CreateFromAccessToken(Session["instagram_token"].ToString()); var recent = instagram.Users.GetRecentMedia(); //local.InnerHtml = "<ul>"; foreach (var media in recent.Body.Data) { //var value = media; //local.InnerHtml = local.InnerHtml + "<li><a href='" + media.Images.StandardResolution.Url + "'><img class=\"thumbnails\" src='" + media.Images.LowResolution.Url + "'/></a></li><br>"; // $(".instapics").append("<li><a target='_blank' href='" + data.data[i].link + "'><img class=\"thumbnails\" src='" + data.data[i].images.low_resolution.url + "'></img></a></li><br>"); } //local.InnerHtml = local.InnerHtml + "</ul>"; } }
/// <summary> /// Initializes a new instance of the InstagramService class. /// </summary> public InstagramService GetService() { return(_service ?? (_service = InstagramService.CreateFromAccessToken(AccessToken))); }
internal InstagramMediaEndpoint(InstagramService service) { Service = service; }
internal InstagramTagsEndpoint(InstagramService service) { Service = service; }
// This method is invoked when the application has loaded its UI and its ready to run public override bool FinishedLaunching (UIApplication app, NSDictionary options) { //ThreadPool.QueueUserWorkItem(el => UIImageUtils.AddImagesToSimulator()); AIphone = this; ImageLoader.DefaultLoader = new ImageLoader(200, 4194304 * 5); DBActivServ = new DBActiviesService(); FacebookServ = new FacebookService(); UsersServ = new UsersService(); ImgServ = new ImagesService(); FlwServ = new FollowersService(); KeywServ = new KeywordsService(); LikesServ = new LikesService(); CommentServ = new CommentsService(); ActivServ = new ActivitiesService(); ReportServ = new ReportService(); ShareServ = new ShareService(); InstagramServ = new InstagramService(); InitializeWindow (); // ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, ssl) => // { // return true; // }; var mainDB = Database.Main; try { LastUserLogged lastUser = Database.Main.Table<LastUserLogged>().LastOrDefault(); if (lastUser != null) { MainUser = mainDB.Get<User>(lastUser.UserId); } if (MainUser != null) { _welcomePage = new UIImageView(Graphics.GetImgResource("pagedegarde")); _welcomePage.Tag = 666; window.AddSubview(_welcomePage); ShowRealLoading(window, "Logging in ...", "", ()=> { //InstagramServ.GetPopular(); AuthSequence(MainUser); }); } else { InitLoginPage(); } } catch (Exception ex) { Util.LogException("FinishedLaunching", ex); } window.MakeKeyAndVisible (); return true; }
public PostSubcommand(InstagramService instagramService) { _instagramService = instagramService; }
public InstagramController(InstagramService instagramService, IMapper mapper) { _instagramService = instagramService; _instagramService.LoginAsync("viphopsy", "Embe3413+").Wait(); _mapper = mapper; }
internal InstagramEndpoints(InstagramService service) { Service = service; }
internal InstagramEndpoints(InstagramService service) { Service = service; }
async void OpenProfile() { await InstagramService.OpenUser(UserName); }
internal InstagramLocationsEndpoint(InstagramService service) { Service = service; }
internal InstagramMediaEndpoint(InstagramService service) { Service = service; }
internal InstagramRelationshipsEndpoint(InstagramService service) { Service = service; }
internal InstagramLocationsEndpoint(InstagramService service) { Service = service; }
/// <summary> /// Initializes a new instance of the InstagramLoginViewModel class. /// </summary> public FeedViewModel(INavigationService navigationService, InstagramService instagramService) { this.NavigationService = navigationService; this.InstagramService = instagramService; }
internal InstagramTagsEndpoint(InstagramService service) { Service = service; }
internal InstagramRelationshipsEndpoint(InstagramService service) { Service = service; }
protected void Page_Load(object sender, EventArgs e) { Callback = Request.QueryString["callback"]; ContentTypeAlias = Request.QueryString["contentTypeAlias"]; PropertyAlias = Request.QueryString["propertyAlias"]; if (AuthState != null) { string[] stateValue = Session["Skybrud.Social_" + AuthState] as string[]; if (stateValue != null && stateValue.Length == 3) { Callback = stateValue[0]; ContentTypeAlias = stateValue[1]; PropertyAlias = stateValue[2]; } } // Get the prevalue options InstagramOAuthPreValueOptions options = InstagramOAuthPreValueOptions.Get(ContentTypeAlias, PropertyAlias); if (!options.IsValid) { Content.Text = "Hold on now! The options of the underlying prevalue editor isn't valid."; return; } // Configure the OAuth client based on the options of the prevalue options InstagramOAuthClient client = new InstagramOAuthClient { ClientId = options.ClientId, ClientSecret = options.ClientSecret, RedirectUri = options.RedirectUri }; // Session expired? if (AuthState != null && Session["Skybrud.Social_" + AuthState] == null) { Content.Text = "<div class=\"error\">Session expired?</div>"; return; } // Check whether an error response was received from Instagram if (AuthError != null) { Content.Text = "<div class=\"error\">Error: " + AuthErrorDescription + "</div>"; return; } // Redirect the user to the Instagram login dialog if (AuthCode == null) { // Generate a new unique/random state string state = Guid.NewGuid().ToString(); // Save the state in the current user session Session["Skybrud.Social_" + state] = new[] { Callback, ContentTypeAlias, PropertyAlias }; // Construct the authorization URL string url = client.GetAuthorizationUrl(state); // Append the scope to the authorization URL if (!String.IsNullOrWhiteSpace(options.ScopeStr)) { url += "&scope=" + options.ScopeStr.Replace(",", "+"); } // Redirect the user Response.Redirect(url); return; } // Exchange the authorization code for an access token InstagramAccessTokenResponse accessToken; try { accessToken = client.GetAccessTokenFromAuthCode(AuthCode); } catch (Exception ex) { Content.Text = "<div class=\"error\"><b>Unable to acquire access token</b><br />" + ex.Message + "</div>"; return; } try { // Initialize the Instagram service InstagramService service = InstagramService.CreateFromAccessToken(accessToken.Body.AccessToken); // Get information about the authenticated user InstagramUser user = service.Users.GetSelf().Body.Data; Content.Text += "<p>Hi <strong>" + (user.FullName ?? user.Username) + "</strong></p>"; Content.Text += "<p>Please wait while you're being redirected...</p>"; // Set the callback data InstagramOAuthData data = new InstagramOAuthData { Id = user.Id, Username = user.Username, FullName = user.FullName, Name = user.FullName ?? user.Username, Avatar = user.ProfilePicture, AccessToken = accessToken.Body.AccessToken }; // Update the UI and close the popup window Page.ClientScript.RegisterClientScriptBlock(GetType(), "callback", String.Format( "self.opener." + Callback + "({0}); window.close();", data.Serialize() ), true); } catch (Exception ex) { Content.Text = "<div class=\"error\"><b>Unable to get user information</b><br />" + ex.Message + "</div>"; } }