is there an API to get all of an Instagram business account's posts that include a particular hashtag? - instagram-graph-api

I am trying to get media with an hashtag that is specific to a particular user. Instead, the api seems to provide all the public images with the hashtags that is not specific to the account.
This is the api to get media nodes using hashtag that I tried:
{hashtag-id}/recent_media?user_id={iguserId}&fields=id,media_type,comments_count,like_count,caption
This one returns the public images associated with that particular hashtag in addition to the account's media that I need. For example:
I am requesting for images in a user's account that has #xxxx as hashtag. I am expecting the account's images alone containing xxxx tag. However, in the response I am receiving images from other accounts as well which has the same #xxxx hashtag. This api seems to work globally and I don't understand the use of 'user_id' parameter in the api.

Check out this API. Very simple to use and you can get media from a hashtag and specify an account. This will help you get all of an Instagram business account's posts.
Python 3.x Implementation:
import instaloader
# Get instance
L = instaloader.Instaloader()
#Load the UserName
profile = instaloader.Profile.from_username(L.context, USERNAME)
#Read the profile posts and downloads those containing the hashtags
for i in profile.get_posts():
if HASHTAG in i.caption_hashtags:
L.download_post(i, target=DIRECTORY_NAME)

Related

Twitter Phirehose - Getting a user stream of user other than the logged in user

$sc = new FilterTrackConsumer(OAUTH_TOKEN, OAUTH_SECRET, Phirehose::METHOD_FILTER);
$sc->setTrack(getTrackKeywords());
$sc->consume();
returns tweets that contain certain keywords, from any users.
$sc = new MyUserConsumer(OAUTH_TOKEN, OAUTH_SECRET);
$sc->consume();
returns tweets by the authorized (logged-in) user.
How do I get a stream that returns tweets tweeted by a specific user-- a user other than the one logged in / oauthed?
I think I found it.
$sc->setFollow(array(
1234, 5678, 901234573 //The user IDs of the twitter accounts to follow. All of
//these users must have given your app permission.
));
If you just want the public tweets of a set of users, take a look at the example/filter-track.php code that comes with Phirehose, but use setFollow() instead of setTrack(). The parameter to setFollow() is a list of Twitter IDs (Important: you have to convert screen names to twitter IDs yourself, first). More on that here: https://dev.twitter.com/docs/streaming-apis/parameters#follow
Note: Those users do not need to have given you permission: you are just seeing what they are showing to the world.
If you want to get all Twitter activity from a bunch of users then you need to use Twitter's Site Stream API. See example/sitestream.php in the Phirehose files for that. (I was the one who wrote that example, but I have never been able to test it: Site stream has been in closed beta since the Dawn Of Time, and it is so "closed" they even ignore our requests for a developer test account!)
The middle ground is the User Streams API. This allows you to get all Twitter activity but for just one user. If you can get each user to not just permission your app, but also give you their secret keys, you could run multiple Phirehose instances, one per user, and amalgamate all the data in a central database. This would be the poor-man's Site Streams :-)

Twitter API - iOS

I am currently creating an iOS app that integrates Twitter in such a way that it loads tweets into a UITableView. Currently I have gotten the tweets to load into the table view but I am having some issues with the names of the tweeters.
I can get the ID of the users. For example 1186989888 is the ID for DummyCode
Is there a way I can get from the ID, 1186989888 and have it return "Dummy Code". Which is DummyCode's screen name.
Does anyone know if this is possible with the Twitter API and iOS?
The Twitter users/lookup endpoint allows lookup by user_id, for up to 100 users at a time.
For a web-friendly view, you can also look up a single user by ID using a intent/user URL, e.g.
https://twitter.com/intent/user?user_id=1186989888

Facebook Multiple tagging on Photo ios

I am using FB graph api to tag multiple friends. I am able to tag only one friend. But not getting success with multiple friends.
For single user:-
NSString *photoID=#"23451245";
[FB_Graph doGraphPost:[NSString stringWithFormat:#"%#/tags/%#?access_token=%#", photoID, #"1235234",[[NSUserDefaults standardUserDefaults]objectForKey:#"fb_accesstoken"]] withPostVars:nil];
For Multiple user :-
[FB_Graph doGraphPost:[NSString stringWithFormat:#"406435626092354/tags?tags=[{\"id\":\"100000947629523\"}, {\"id\":\"100000106756234\"}]?access_token=%#",[[NSUserDefaults standardUserDefaults]objectForKey:#"fb_accesstoken"]] withPostVars:nil];
tags
Create:
You can create a tag on the photo by issuing an HTTP POST request to the tags connection, PHOTO_ID/tags.
Note: This feature is intended to help users tag their friends in real photos. You should not use this feature to encourage users to tag their friends if their friends are not actually in that photo, or to tag friends in composite photos. If your app is found to be encouraging this behavior, your usage of this feature may be disabled.
You can specify which user to tag using two methods: in the URL path as PHOTO_ID/tags/USER_ID, or in a URL parameter as PHOTO_ID/tags?to=USER_ID. To add several tags at once, you can specify a tags property which contains an array of tags like so PHOTO_ID/tags?tags=[{"id":"1234"}, {"id":"12345"}]. Currently, you cannot tag a Page in a photo using this API.
Tagging a photo requires the user_photos and publish_stream permissions, publish_stream is optional - if not present, the tag will go through Tag Review of the tagged person if s/he has this privacy setting enabled. Tagging a photo supports the following parameters.
For more details visit Facebook Developer Site.

Rails - Twitter API: how to get from ID link to Twitter profile?

From the Twitter API I obtain user's ID (of course beside profile link, username etc). How can I display the link to user's profile according his ID?
For example, Facebook API provide user's ID as well, and if I put to the browser www.facebook.com/users_id, I'll get his profile...
Is there any way to do with Twitter? www.twitter.com/users_id returns empty page...
EDIT: obviously I can save user's URL (or his username), but the respective user can whenever change it...
what do you call a twitter "profile" ? I guess you talk about the user timeline
according to the api doc, your url should probably look like this :
https://api.twitter.com/1/statuses/user_timeline.html?&user_id=(your_id_here)
however, i would advise to use one of the twitter api gems to ease your pain...

What is the best practice to store twitter profile images

The Twitter API documentation for GET users/profile_image/:screen_name states that:
This method should only be used by application developers to lookup or check the profile image URL for a user. This method must not be used as the image source URL presented to users of your application.
This API call returns a 302 redirecting to the profile image url. What is the best practice to make those images available for ones application? The easiest way it seems, would be to use the resulting url string and embbed it in the apps html code (e.g. in the src of an img tag). The alternative would be to store the image locally as a file or in a blob field.
Is linking the image covered by the "must not" or does that mean that you shall not call the API, but you do can use the resulting url?
In the past, I've simply stored the URL in the database and then reused the url when I needed to present the image.
Pulling down and storing the images is more complex and adds a dependency for access to the stored images on your application.
I'd also recommend that you re-fetch the image url periodically as users change their profile pics sometimes.
The twitter api states:
Once an end user has authenticated via Connect with Twitter, you must clearly display the end user's Twitter identity. Twitter identity includes visible display of the end user's avatar, Twitter user name, and the Twitter "bird" mark. Displays of the end user's followers on your Service must clearly show that the relationship is associated with the Twitter service.

Resources