How to categorize tweets using Twitter API - sttwitterapi

I'm planning to create a news website using twitter API to fetch tweets of specific news resource accounts. Is there anyway to categorize them into sports, break news, culture ... etc?
Here's the example of sample timeline result
https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-user_timeline

Aside from doing your own post processing with location, text or bio NLP, this isn't something included from Twitter in the raw Tweet payload today. However this could be a good feature request for endpoints built through the new Labs program that Twitter is running.

Related

How to get all unique email recipients python gmail api

I want to do a search for all unique email recipients from gmail. But I'm really struggling with API. If I was interacting with a SQL database I would want something like:
SELECT DISTINCT EmailRecipient FROM MyHypotheticalGmailTable;
But I'm not sure how to translate this into a gmail API call.
I suggest you start by taking a look at the Gmail API Quickstart with Python here.
Afterwards you may want to take a look at threads.list in order to list all the threads available and then for each one use threads.get. Since there is no direct method of retrieving the unique email recipients, you will have to handle this separately from the API calls and filter the results programmatically.
Reference
Gmail API Python Quickstart;
Gmail API messages.list;
Gmail API messages.get.

Search tags on a specific user profile (Instagram)

As a part of my yearly career goals at work I decided I would try and tackle a simple database-tyoe webpage.
I was curious if there was a way for me to search tags on a specific user profile (Instagram)?
My idea is to code a single-page webpage that uses a search function to find tagged posts on a specific users Instagram account and display the results. Is this possible? Tips or resources would be helpful.
There is currently no Instagram API endpoint that will allow you to retrieve all hashtagged photos for a specific user. You will need to retrieve all the users posts using the user https://developers.facebook.com/docs/instagram-api/reference/user/ endpoint and then filter the results.

AlchemyAPI call to ingest news by URL

I use the AlchemyData News API to search for news articles by category to receive sentiment and company information.
Is there a way to instead of searching for an article, to feed an Article URL or headline to the service to have the article ingested to get sentiment and company info?
You want to use the AlchemyLanguage API, specifically the entity extraction feature, to get this type of information about a specific article or body of text.
For example, you can issue

How to implement Facebook Post Type objects in GAE?

I a new programmer and trying to implement a facebook type "feed" in my application. Like Whenever a user do some changes in his profile his linked profiles will get to know that in the form of news feed.
But I am stuck on that as I thought whenever any user saves any data (like "News", "Blog", "Event" or any "Comment") just send the id of the respective classes to the linked profiles and they will see it. Since the id is not generated before the object is saved , the problem is how can I send them. I thought of following workarounds but each have some problem.
Whenever a user posts a news .... a Post object will be made and added to User's Post Collection.
But How do the other users will knew about it.....
1) Send them the id .... but when the id is not created how can you send them the id.
2) Send them the post message and when ever they will click them ... the latest post to them from the particular user will be shown.. but if more than 3 messages then which will be shown?? Shown by the post creation Date no post greater than that date is shownn....but he needs to be shown newer posts..
3) Save the post in all followers feed. the data will be much larger then
4) all the followers on login will check all the persons they are following and save their feed after the time stamp? How to implement this as the Post is saved in User's Profile so I would have to check all the following person and then just check the feed and show them on his feed box; I think I would have to use batch Processes. Processing will take much longer.
I am using objectify-appengine to do operations on GAE.
Any help is appreciated
Are you wanting to update the page with posts in real time like on Facebook and Twitter? To achieve this on Google App Engine you can use the Channel API, which works in conjunction with Javascript to listen for new data and update the DOM.
This talk at Google I/O 2009 by Brett Slatkin describes exactly the pattern you should use for this.

Managing sessions with C/CGI

I'm looking towards writing some applications with C and CGI, and now that I've implemented basic functions like URI encode/decode, HTML entities encode/decode, query/cookie parser, etc. I need to manage sessions. How should I do this? For example, how does PHP manage sessions?
Store the UserID and SessionID in a cookie, then store all other data on the server in a database. Do not encode user and session in the url as this leads to session-hijacking even if the user only wants to show some friend a link.
As HTTP is stateless, you have to maintain an id that can track your session. The two main ways are to use cookies to store the id or to embed the id in the URL, usually doing URL rewriting.
You can have a look at WT which is a web toolkit written in C++. see also this SO question for a list of c++ web framework. you will probably find how they handle sessions.
my2c

Resources