I'm looking to make an React app that compares some local data with Twitter hashtags using the Twitter API to pull local trending hashtags based on a user's location.
The Twitter API I'm looking to use is the trends/places ( https://developer.twitter.com/en/docs/trends/trends-for-location/api-reference/get-trends-place ) which is at:
https://api.twitter.com/1.1/trends/place.json?id=30079
Where id is a WOEID (Where On Earth ID) but actually obtaining this seems to be difficult. There are many stack overflow questions but they're mainly dated several years ago and reference now defunct APIs.
I can get this by using the Yahoo Weather api with a text search:
https://www.yahoo.com/news/_tdnews/api/resource/WeatherSearch;text=birmingham,%20uk
But this would mean getting the Lat/Long from the user, processing this to get the City / Area, querying the weather API with a text search, extracting the WOEID from the response and then querying the Twitter API wit it.
It seems like I'm missing an easy and obvious endpoint somewhere, or there is an already built solution I'm not finding - any help very much appreciated, and apologies if I've missed something here it's my first question!
If anyone else comes along with this issue there is another endpoint to get this on the Twitter API:
https://api.twitter.com/1.1/trends/closest.json
takes lat and long parameters and returns JSON object with woeid included, which can then be used for the trends data at:
https://api.twitter.com/1.1/trends/place.json
Doesn't seem to be obvious in the API guide, going by all of the Q&A type results from a google search - hope this helps someone!
I am currently writing my first "webapp" using javascript and the untappd API. The API documentation can be found here: https://untappd.com/api/docs#start
For those who don't know, untappd is an app that let's you checkin and rate beers with your phone. My plan is to make something that can recommend you a beer based on your own top rated beers in untappd! Just a hobby project.
So far I have been able to make the API call based on the username you fill in, parse the JSON data and display the top 10 beers in HTML cards on a webpage.
The next step would be to take certain characteristics of the top 10 beers (type of beer, brewery, rating for example) and use them as parameters to search for similar beers.
The problem however is that the "search beer" API of untappd seems quite limited. E.g. it doesnt return the global rating of the beers you find. Also you cannot search for a specific type of beer. For example if you query IPA - American" it might return a "IPA - Imperial/Double Black". You can find the untappd search beer API here: https://untappd.com/api/docs#beersearch
I was also thinking of using a different beer database to make the search however it doesnt seem there is a good public database around that I could use for this.
So basically I am looking for idea's. Maybe there's a better solution that I'm not seeing. Or some workaround that I can't think off.
It looks like the /beer/info/{bid} endpoint returns more details for each beer, so you could potentially perform the search, then iterate on each beer to grab additional details. Could use Promises.all() to help.
As far as filtering on specific type, unfortunately I think that is a calculated limitation in their public API to prevent API consumers from building robust integrations that may draw more attention to said integration. So you could also use the above endpoint to perform your own filtering on your end to only grab beers by type.
I've been searching for a while about how to retrieve something like a "main category" from each Wikipedia article. I'm using the wikipedia API to retrieve the data but I'm getting multiple objects of categories within an array instead of one concise category.
I've seen people implement this, for example facebook in this page shows "Harry Potter and the Deathly Hallows: Part II" and if you see above this title there is a category that says "MOVIE" and it applies for everything, it could be "BOOKS", "MUSIC", "ARTISTS", "ANIMALS" which is what I'd like to get when using the API, I want this because I wanna make searches by using this specific category (I know that facebook is probably consuming the Wikipedia's API because the page says "FROM WIKIPEDIA, THE FREE ENCYCLOPEDIA" and it's like this everytime you find something which is like a copy and paste of the original wikipedia article.
Here an image if you don't wanna go to the link:
I've been reading for quite a while the Docs that the Wikipedia/Mediawiki API offers but haven't found anything that can help me so far, also I've read this question but the answer is not really helpful in my case and it's from two years ago.
Here is an example of how I'm consuming the API, for example here I made a search for "Harry Potter" and limit the request to get 3 results:
https://es.wikipedia.org/w/api.php?format=jsonfm&action=query&generator=search&gsrnamespace=0&gsrsearch=Harry%20Potter&gsrlimit=3&prop=pageimages|categories&pilimit=max&utf8=1&exlimit=max
Any help or recommendation about how to fulfill this approach is appreciated.
Wikipedia has no concept of one category being more main than the others, and the ordering does not help either (it reflects the order in the source, which typically means automatically generated categories first, important categories at the end). Your best bet is probably to use the Wikidata API and fetch the value of the "instance of" attribute. E.g. HPatDHp2 is an instance of movie.
How to Exclude retweets and replies in a search api?
I am trying to fetch the feeds from twitter using search api, in the result I am getting replies and retweets also.
So I want to exclude replies and retweets.
How to do it anybody help me.
This is my url:
https://api.twitter.com/1.1/search/tweets.json?q=from:rioferdy5&count=20&result_type=recent
I beleive the above is incorrect, you can use filters in the search API but the documentation is very poor (non-existent?).
Your query would become:
?q=from:rioferdy AND -filter:retweets AND -filter:replies&count=20&result_type=recent
More tips for filtering were obtained here: How to Master Twitter Search: Basic Boolean Operators and Filters
Old post, but people might still stumble upon it.
Most query operators are documented here: https://dev.twitter.com/rest/public/search
But for the search/tweets method, you can also specify exclude:replies and/or exclude:retweets to filter out replies and retweets from the result.
Just test it in the API Console Tool and see for yourself.
Bonus: Another undocumented query operator is filter:verified to get tweets from verified users.
Example query: cats filter:vine filter:verified exclude:replies exclude:retweets
In the new Search Tweets API, including the following parameters will remove different flavors of retweets:
-is:retweet Excludes retweets
-is:quote Excludes quote tweets
-is:reply Excludes replies
Please see the API documentation here: Search Tweets - Build a Query
Only Mike Chen's response (which oddly had 0 upvotes until I upvoted it) is correct. The rest of the answers here are out of date due to the launch of the Twitter API v2. I would comment directly on Mike's answer, but I don't have enough reputation.
Very late reply, like everyone else but I feel the second answer here by Paul should be the "correct" one. I wish twitter would document this better, or make it more well known but there are a TON of search filters you can do, even with their standard API in 2018.
https://developer.twitter.com/en/docs/tweets/rules-and-filtering/overview/standard-operators
Here's a rather comphrensive list of examples :) and retweets is somewhere in the middle.
-filter:retweets
yes, you can exclude the retweets during search API by adding -RT in the search string (q). Ex: search?q="#demo -RT"
This is allowed as documented in the official documentation
puppy -filter:retweets containing “puppy”, filtering out retweets
https://developer.twitter.com/en/docs/tweets/rules-and-filtering/overview/standard-operators.html
Found this while searching how to do this in the new v2 API, and it's now puppy -is:retweet -is:reply (no longer need the ANDs either)
https://developer.twitter.com/en/docs/twitter-api/tweets/search/integrate/build-a-query#list
According to the official documentation
Pass the following parameter exclude_replies=true
Sorry I'm late to the party here. I agree with Hitesh in that they do not provide a way to exclude retweets natively, but every tweet that is a retweet has a retweet object in the json returned. So you could loop through your tweets and exclude any that have a retweeted_status typeof 'object' (meaning they are a retweet from someone else) or keep those that have a typeof 'undefined' (meaning they are original). The issue with retweet_count=0 is that someone like #pattonoswalt will have retweets on all of his tweets. So the count will never be zero even though they are all originals.
You could use something like so in a loop:
if(typeof tweets[i].retweeted_status === 'object') {tweets.splice(i,1);}
or
if(typeof tweets[i].retweeted_status !== 'undefined') {tweets.splice(i,1);}
There is no direct way to exclude retweets and replies from the api. However, you can filter out the results you have got.
For replies, you can check if the in_reply_to_status_id field you get from api is null, that means its not a reply else if it contains a id, then its a reply.
For retweet, if you want posts that have not been retweeted ever, you can check for retweet_count = 0 or if you want posts that have not been retweeted by your authenticated user, you can check for retweeted = false
Just use nitter.net
it allows you to exclude things from the search results (via advanced search options on the right end of its search bar), and it even provides its own RSS feed. On top it expands these t.co short URLs and replaces the youtube URL with the invidio.us URL
In the end you may use your RSS feed as a trigger for other web-applets through the self-hostable interface called Huginn
What I would like to do is find out the userId of the Nth user to like a page.
So far I am thinking it is not going to be possible.
Have found the following
http://www.facebook.com/browse/?type=page_fans&page_id=[PAGE_ID]
which seems to show some of the users but only the first 400/500
I thought it may have been possible using FQL but am thinking it is not going to be since page_id is not an indexable column.
http://developers.facebook.com/docs/reference/fql/page_fan/
Saying that I found the following stackoverflow question which suggests it is possible but does not provide code Facebook API: Get fans of / people who like a page , the following post which got me hopeful Can I get a list of the people that have Facebook-liked my page? but checking http://developers.facebook.com/docs/reference/fql/like/ looks like that wont work
It also points to this page which also seems to point to the fact it is not possible, Retrieve Facebook Fan Names (this answer seems to be the most voted Retrieve Facebook Fan Names). The following post seems to say yes and no at the same time Querying Users who 'like' my Facebook Page . So am I right in assuming that it is not currently possible?
Appears to be a bug. See https://developers.facebook.com/bugs/231272073596022 I wonder if it will even give you the actual order in which the fans liked the facebook page.