I'm using this link to get popular tweets (in English for example)
https://api.twitter.com/1.1/search/tweets.json?q=('[]')&lang=en&result_type=popular&count=100
But it GETs the popular tweets in current week. Because of this, the result of it is repetitious! If you see its result ever and ever in one day, the same tweets you will see!
but how can I change the period of it? for example just GET the popular tweets since yesterday?
I tried to use since ID field but it's Non-variable.
I'm using PHP.
Related
I am using Google Search Console for php to obtain search analytics of my website. I know Google provides data for 90 days, but the end date to that range is not the current date, but usually a couple days prior. Is there a simple way to find the true end date for the data provided? I know I could send requests for recent days and work backwards until a result is returned, but I feel there must be a better way.
The Search Console provides the Search Data 3 days later. So today (20.06.) you see the data from 17.06. You just have to check at what time the data apears. This is form SC to SC a little bit different.
I am working on sentiment analysis for which I need twitter feed. I have implemented the php code to get the json feed and parse it as I wanted. the problem is I could not find a way to get json feed as per the date specified.
$query = array(
'screen_name' => 'twitterapi',
'count' => '5'
);
Using the above syntax I have to specify the number of tweets but my requirement is to get the feed for specific date. Is it possible to pass date parameter instead of count.
currently I am using $path = '/1.1/statuses/user_timeline.json';
I have also implemented the mechanism to manually filter the date but for that I have to provide very large count for older dates that unnecessarily slows down the code.
There are two ways you can do this.
Firstly, read the documentation for the API call you're making. You can't pass a date - but you can request up to 200 Tweets and, if that isn't enough, page through up to 3,200 of their most recent tweets.
Secondly, read the documentation for Searching Twitter, you can use the until parameter to search for older Tweets. Twitter's search API only goes back ~7 days. As they say:
Please note that Twitter’s search service and, by extension, the Search API is not meant to be an exhaustive source of Tweets. Not all Tweets will be indexed or made available via the search interface.
I'm fairly new to PHP, and I'm trying to write a script that solves the following
I have an RSS feed that gets saved to my server every 10 minutes (copied from elsewhere).
There is a problem with the timestamps (pubDate tag) on the RSS feed, they always have the correct date but 00:00:00 GMT as the timestamp (I have no control over this).
Therefor, when I use an autotweeting program to tweet updates from the feed (it checks it every hour or so), it won't - It only tweets the first update of each day as a result.
Therefor, what I'm trying to do to fix it to some degree is to check if the feed has changed, and if it has, change the saved pubDate to the current server time on only the new items.
I'm also kind of confused as to how I can have it check for changes - If I have a corrected version (with fairly accurate timestamps) saved to my server, it will ALWAYS think there are changes, because the timestamps will always be 00:00:00. I'm thinking, check both feeds for items including the full strings such as <guid isPermaLink="true">http://services.runescape.com/m=adventurers-log/a=161/display_player_profile.ws?searchName=A13d&id=-463827091</guid> - Since the id= at the end stays constant, it would only change the <pubDate> of items found to be new.
http://services.runescape.com/m=adventurers-log/a=161/rssfeed?searchName=A13d Here is a feed as an example. If anyone could get me started or point me to some kind of tutorial that might help, I'd really appreciate it. This is over my head, but something I need to learn how to do.
Maybe there is something wrong with your code parsing the timestamp, date format perhaps?
I believe the method of doing full string comparisons(<title> & <description>) between items with the same <guid> is your best bet. Here is some reading about RSS duplicate detection if you are interested.
I am trying to add a Google calendar to a website I'm making that the client will be able to update themselves. I found this: http://mikeclaffey.com/google-calendar-into-html/ which has been quite helpful, but I am a bit stuck.
The website I am building is using PHP template and the page contents is contained within the $content variable. Here is the link I'm working on: http://victoriasawyer.com/AmosTheTransparent.
The calendar feed is the top one of the two lists of Tour Dates. I would like the top one to look similar to the bottom one. The same would be ideal but not necessary.
The biggest issue I'm having is with the start date and time. In the title of the event I would like just the date to show (preferably like 10/03/14) not the time. I have figured out how to display just the time separately without issue. Is there some way to change the date format?
The other issue I'm having is the order that the events are appearing. I would like the events to show with the soonest one first in the list and the furthest one last in the list. I added the additional parameters as instructed in the tutorial (orderby=starttime and sortorder=ascending) but they do not display correctly.
The url I am using is: https://www.google.com/calendar/feeds/qmfadhgtq2kmabsi3dlb456v98%40group.calendar.google.com/public/full?orderby=starttime&sortorder=ascending&futureevents=true&alt=json. Is there something I can adjust or add to fix the order?
Any help will be much appreciated (even if you can recommend an alternative. It just needs to be customizable, and so far this seems to be the best option I have found).
You can use PHP's DateTime class like this:
$date = new DateTime('Sun Nov 16 2014 00:30:00 GMT+0000');
echo $date->format('Y-m-d');
You can then use the predefined formats in PHP which are listed here to format it into whatever style you like.
echo $date->format('d/m');
echo $date->format('d/m/Y');
There is something I am trying to accomplish although I'm not really sure where to start.
I currently have a MySql database with a list of articles. The DB contains the article title, content, and some other info like dates, etc.
There is an RSS feed that we monitor for new articles, it's a Google Alert feed that just contains the latest news on certain subjects. I want to be able to automatically monitor this feed and record any feed items that are similar to stories currently in our DB.
I know how to set a script to run automatically, and I know how to parse the RSS feed with SimplePie.
What I need to figure out is how to take the description of the rss feed items, run a check on our DB to see if the feed item is similar to something we have in our DB, and return a numerical score of some sort, sort of like a "similarity rating" or something.
After that I can have the info I need recorded to the DB if the "similarity rating" is above a set limit, which I know how to do.
So my only issue is how to compare each feed item to our current articles, and return a score based on how similar it is.
The Levenshtein function (available for both PHP and MySQL) is a good way to handle this. It basically calculates a value based on the number of permutations (replacements, moves, etc) required to convert one string to another. That score would be your "similarity rating".
EDIT: the Levenshtein function is not available natively in MySQL but there are SQL implementations of it that you can use such as: http://kristiannissen.wordpress.com/2010/07/08/mysql-levenshtein/