You can get all tweets for a user: via the getUserTimeline() method.
You can also get all tweets after a specific date: sinceId() method.
But I want to combine these two. I want to get all tweets from a certain user, but only those tweets which were posted after a given date. Any ideas on how to do this?
I don't understand why you need sinceId(). getUserTimeline() returns a paginated list of Statuses. For each status in the list, doing status.getCreatedAt() returns a Date which is a Comparable. You can easily compare Date instances with each other and determine if a Date occured after another Date.
I wound up just using the id of the tweet, as a marker for the date. I didnt care about the date per se, but simply whether the tweet was before or after the previously loaded tweet. The docs suggest that the id is a more or less reliable indicator of recency. I.e., id 1234 is most likely to be a tweet that was posted before id 1233.
Thanks!
Related
I want to use smart sheet api to read sheet data. my sheet has changedtm column. I want to fetch rows which are greater than certain date. is there any way to do this using smart sheet API
You can't do this kind of filtering via the Smartsheet API exactly. One approach would be you could do a GET Sheet request and use the columnIds query string parameter to provide the id number of the specific column you are looking to review. Then you would get back a response that only contained data for that specific column. The filtering based on the date values would then have to be done by you in your code.
If you will need other data in the rows I would then just do the GET Sheet request to get all of the data in the sheet and do the filtering of the response in your code.
I am using the Facebook Marketing API and making a call to get the adsets belonging to an adaccount (https://developers.facebook.com/docs/marketing-api/reference/ad-account/adsets/). My issue is that for one of my ad accounts, there are to many adsets available and as such the call is either taking long or has to many pages. Is there a way that i can possiblly add on date filtering to the request so that it will filter out all those adsets outside of the specified dates?
This is the request i am making with a dummy act id:
act_12345678?fields=account_id,name,currency,business{id},adsets{id,name,campaign{id,name,start_time,stop_time,spend_cap,status,insights.date_preset(lifetime){spend}},start_time,end_time,adset_schedule,billing_event,lifetime_budget,budget_remaining,daily_budget,lifetime_imps,status,configured_status,optimization_goal,is_autobid,insights.date_preset(lifetime).as(lifetime_insights){spend}, insights.time_range({'since':'1990-01-01', 'until':'2018-04-26'}).as(insights_to_date){spend}}
It appears that the "filtering" parameter works in this case.
For example, if you want to return all adsets that had a start time greater than 12/31/2017 and less than 01/31/2018, you can try the following.
Note that I had to first convert the start and end dates to a UNIX timestamp:
act_12345678/adsets?filtering=[{'field':'adset.start_time','operator':'GREATER_THAN','value':'1514678400'}, {'field':'adset.start_time','operator':'LESS_THAN','value':'1517356800'}]
You can add the "filtering" parameter to your request URL, and it should then filter both on the dates and the fields you specified.
To convert the dates to UNIX time stamp I used the following link: https://www.unixtimestamp.com/index.php
I am trying to fetch links that were posted on a public Facebook page sometime ago, in 2011 for example. Specifically, the Arabic CNN page on facebook: http://www.facebook.com/CNNArabic
Things I tried:
1- Graph API, a query like this:
CNNArabic/links?fields=id,name,link,created_time&limit=25&until=2012-05-15
2- FQL
SELECT link_id, url, created_time FROM link WHERE owner = 102581028206 and created_time < 1337085958 LIMIT 100
Both give an empty data set while there is data on the page on or before this date.
Other things I noticed:
1-If I changed the date to something like 2013-01-17 (which is yesterday), it works fine.
2-If I changed the date to something like 2012-12-17 (about a month ago), an empty data set is returned, however if I followed the next page links in the returned data set from the query in number 1 above until I pass by this date I actually get data.
I tried writing code that kept following the next page pointers until I reach the links on the date I want. However I need data much older (say in 2011) and the result set gets exhausted say 2 or 3 months earlier than now, in other words no more next links are returned so I actually can never reach that old data.
To cut this short:
is there a way I can query links that were posted on a public page before a specified date?
Querying the page's feed works in the Graph API:
/102581028206/feed?fields=id,link,name,created_time&limit=25&until=2012-05-15
This returns all the posts. There should be a way to filter this using field expansion, but I couldn't get the few things I tried to work.
You can get this filtered for links only with FQL on the stream table:
SELECT message, attachment, created_time FROM stream WHERE source_id = 102581028206
AND created_time < strtotime('2012-05-15') AND type=80 LIMIT 10
Links are type=80.
I am trying to determine the hottest tracks in the range of May 1 2012 to May 10 2012.
Unfortunately, the following query returns an empty set of tracks:
http://api.soundcloud.com/tracks?limit=20&order=hotness&created_at[from]=2012-05-01&created_at[to]=2012-05-10&consumer_key=
It is however clear that there exist tracks created in that range of time because the same query works when the order parameter is omitted:
http://api.soundcloud.com/tracks?limit=20&created_at[from]=2012-05-01&created_at[to]=2012-05-10&consumer_key=
I was hoping for the hotness algorithm to work across any range of time.
The other strange thing I found is that when a query parameter is specified along side the hotness and created_at parameters, results are returned:
http://api.soundcloud.com/tracks?limit=20&order=hotness&created_at[from]=2012-05-01&created_at[to]=2012-05-10&q=a&consumer_key=
Unfortunately it looks like the results are not sorted by hotness (though I think they may have been at some point in the past).
Any tips on how to get a list of tracks sorted by hotness within a specific time range?
The hotness parameter has been deprecated as of April 16th, 2013. As an alternative, you can rank tracks based on the number of plays (playback_count), downloads (download_count), favorites (favoritings_count), comments (comment_count), likes (likes_count), or reposts (reposts_count) on a track object.
Can we get the number of updates since a particular timestamps using graph APIS? Number of updates might be number of new New feed or Messages.
depending on which api you are calling
When searching for public posts or posts on the user's News Feed, you
can page over the results by using the since, until and limit
parameters. since and until both accept a unix timestamp. When paging
back in time, you should use until in conjunction with limit where
until is the unixtime value of the created_time field in the last
object returned by your previous query. When paging forward in time
you should set since to be the unixtime value of the created_time
field in the first object returned by your previous query. Please
note, you can only search about 1 to 2 weeks back in the News Feed.
/me/feed?since=2+hours+ago&until=now "using strtotime in php"