I try to make social network (like instagram )
User have posts and followers etc
I want for home feed show posts just from users i follow.
User have array with ids of users he follow. So idea is to query from colloection “Posts” where id is equal to one of ids and sort them by timestamp and limit them.
I could make for loop for each in following array but this will be unusable for more than 100 following users.
Edit how I think it could be solved
Hello i dont know if im doing it right but here is my solution for social network like instagram or any other where one user follow other users and have feed from their posts ordered by date.
Each user have its own Collection Timeline where are posts references (postId, createdAt, createdBy) that user should see at his feed, when user start following other user it will put all his posts to feed. For display feed I just call on User timeline, sort it by date and request just 25 of them.
When user start the app I loop trough all followers and request their posts younger than lastTimeline timestamp from their posts collection if they have any I add them to timeline.
I would be happy for your opinion.
You can loop through all the followed user ID and then request the first 5 posts of each one.
Or use some kind of paging
Related
I have access to Twitter API for Academic Research, and I'd like to get the follower count on a given date of a user, or at the time of a tweet.
The doc mentions that "This fields parameter enables you to select which specific user fields will deliver in each returned Tweet.", so I assumed that by adding public_metrics to the users.field, the number of followers can be seen in each returned Tweet, however, in each returned Tweet, I can only see user_id. https://developer.twitter.com/en/docs/twitter-api/tweets/search/api-reference.
Is it even possible to achieve what I want with Twitter API for Academic Research? Is there any other approach to make it?
Thank you so much.
You cannot get the follower count on a specific date; it will always be the count at the time you make the API call.
You may need to add expansions to your API call in order to receive the values you are trying to pull out.
I want to find how many tweets of user A did their specific follower B favorited. Is there any way to do this using either Python's tweepy or R's rtweet?
Many thanks!
You can do this, but it is a bit complicated.
You need to use GET favorites/list
This will let you get up to 200 Tweets that User B has liked. You would then have to search through the returned Tweets to see which ones were posted by User A.
The Tweepy documentation for favorites tells you how to do this:
tweets = API.favorites("edent")
Will get you all the tweets I've liked.
I am using parse as a server for my iOS application. One major component of the application is when a user updates their information, I want this new information to be available to their friends. Right now the only way i can think of to do this is by running a query with the current friend information and seeing if this matches the friend information. However, I do want to run a query for all friends as this would take a while. Is there any quicker way to accomplish this.
As an example
starting information
User: Name: Favorite color: Friends:
Daniel345 Daniel Blue David
and then the user changes the information to be
User: Name: Favorite Color: Friends:
Daniel1345 Daniel Green David
how can i structure a query so that David's friend information will be update to show that Daniels new favorite color is green?
I recommend you do this query to know if a user have changed any value, not a specific one.
You can do the following:
1) When a user (user1) adds a friend(user2) to it's circles you add this friend's(user2) id into a table of all friends.
1.1) In that table you can add a column called "updated". It will represent if the data of that user(user1) is updated in the user(user1) app.
1.2) the table should look something like this (user(pointer),friend(pointer),updated(number))
2) When one of the user(user1) friends changes (Updates) it's data you can change a boolean value(updated) in the friends list.
2.1) You will need to do that to all the it's friends.
3) To fetch the all the friends that have changed their data just get all the friends that the 'updated' value equals to 1
Basically, every time a User fetches all it's friends that have changed their data you reset all the 'updated' values back to 0. If a user haven't fetched the data and a one friend changes it's data twice then nothing happens, the value remains 1 (Think of this value as a way of letting you know that you have an update in one/some of your friends)
I am using twitterizer in an ASP.NET-project. I nned an example (code) how I can use twitterizer to show a list of followers (paged) for a special account that don't follow back.
The query is: Give me all users that I follow for e.g. 5 days but that didn't follow me back. The result should be displayed in a GridView with paging.
Thanks!
As I stated in the email, there is no way to filter friends or followers by date.
Your best bet to do this is to use TwitterFriendship.FriendsIds() and TwitterFriendship.FollowersIds(), then select the difference between the two. That will give you the list of followers that you don't follow. (Friends are users you follow.) In order to identify new friends/followers, you'll need to keep a list of the Ids, then consult that list at a later date to see the changes over time.
You could create a database (or list, etc) of users you followed and users who follow you. Update this as often you you need and add a time stamp for each new addition. Then you could query this database to create the list you want.
I have a model user, a feed, and a comment. user has many feeds and comments, feeds belong to user and have many comments and finally comments belong to user and feed.
No when i show feeds for a certain user, it selects all the comments made till date for every feed. I want it to select only those comments that were made in the last 1 min, and if none were, i want to show the 2 most recent ones... how can i do that???