I'm working on google ads api to get user interests in french. Im using the search query :
$this->googleAdsServiceClient = $this->googleAdsClient->getGoogleAdsServiceClient();
$query = 'SELECT user_interest.user_interest_id,user_interest.name,user_interest.taxonomy_type FROM user_interest ORDER BY user_interest.name';
$stream = $this->googleAdsServiceClient->search($this->CUSTOMER_ID, $query);
Result for the above query is in english. I want to get it in french lanaguage. Can i achieve it by passing locale or any other parameter ?
Related
I am collecting Data from twitter for data analysis.i need a collection of tweet contains "#depression" tag for make a dataset . it is very difficult to go to search then copy and paste.
if there are any existing code/plugin/api to get all post with username and post date? i will use it to store post,username,date on my excel dataset.
I would recommend a bit of python for this. Incidently, here seems to be a script that does something like what you want. It will get all tweets from a specified date, with a specified #tag - and print them to a CSV file. I guess you could import the file in Excel.
The script:
https://gist.github.com/vickyqian/f70e9ab3910c7c290d9d715491cde44c
I have not read it thoroughly - so read through it before invkoking. And of course replace the #tag parameter:
...
for tweet in tweepy.Cursor(api.search,q="#depression",count=100,
...
You also need to to set up the parameters:
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
Here's the instructions on how to get those:
https://developer.twitter.com/en/docs/basics/authentication/guides/access-tokens.html
And you need to specify the fields that you are requiring in this line
print (tweet.created_at, tweet.text)
These fields are available:
text = tweet.text
language = tweet.lang
date = tweet.created_at
username = tweet.user
retweets = tweet.retweet_count
likes = tweet.favorite_count
So you could change it to this:
print (tweet.created_at, tweet.user, tweet.text)
I am using GMAIL API to get messages between a date range. My problem is for one of my client account the display datetime and actual received date/sent datetime differs. IS there a way to read messages in UTC time zone?
Thanks,
Haseena
There is an open issue that affects the timezone of dates in search queries. Unfortunately there is no workaround at the moment.
$newTime = strtotime('-15 day');
$after = strtotime(date('Y-m-d H:i:s', $newTime));
$opt_param = array();
$userId = 'me';
$opt_param['q'] = "after:$after";
$messagesResponse = $service->users_messages->listUsersMessages($userId, $opt_param);
when a user login using facebook then i need collect all the movies list liked by the user and his/her friends.
user = FbGraph::User.fetch('me', :access_token => "access_token")
userFrnd = user.friends
movies=[]
userFrnd.each do | uf |
frnd = FbGraph::User.fetch(uf.raw_attributes['id'], :access_token => "access_token")
movies << frnd.movies
end
final_movie_list = movies.flatten.uniq_by {|track| track.raw_attributes["id"]}
this is my fb_graph function and it's working fine.but i need to make it as batch request since the i have 360 friend it take 360 request to process the above function correctly.but help me out to optimize this and reduce the time it takes to calculate this function.
I came to know that batch request may help me but,i don't know how to do that in fb_graph.
Please help me
I'm using FbGraph from ( github.com/nov/fb_graph ) Version: 2.7.8 and I'm able to make a batch request for 100 users, at a time and get following information about them by default.
I'm not using any access token. So you might be able to get more information including movies.
id
name
first_name
last_name
link
username
gender
locale
Here's the demonstration code where ids is an array of Facebook User Ids:
r = FbGraph::User.fetch("?ids=#{ids.join(",")}")
r.raw_attributes #information about the users hashed by their id (String)
Is it possible to get tweets which contain photos? I am currently using twitter search api and getting all the tweets having entity details by setting include_entities=true. I see picture details under media object but is there anyway to filter and get tweets objects which just have these media items. Or is there anyway in Twitter4j to do this query?
There is no specific way to specify that I need only photos or videos but you can filter the results based on filter:links or filter:images or filter:videos in your query along with include_entities=true.
For Example: To get the tweets that contain links since 2012-01-31, you query should have include_entities parameter as well as filter:links as shown as follows:
https://search.twitter.com/search.json?q=from%3Agoogle%20since%3A2012-01-31%20filter%3Alinks&include_entities=true"
As your need is to filter your tweets based on images/photos, I think you should use filter:images.
An example of your case would look like:
https://search.twitter.com/search.json?q=from%3Agoogle%20since%3A2012-01-31%20filter%3Aimages&include_entities=true"
Hope this helps.
With Latest twitter API I couldn't get filters work and I couldn't find either any explanation in their docs. Althought you can get all the tweets and then parse only the media ones. You can fire this if inside your parsing script:
if(this.entities.media != null){
//Parse the tweet
}
This is not the best solution but the worst part comes to twitter who's giving you more information and using more of its own resources.
In the lastest twitter API you can do it in the ConfigurationBuilder instance, before creating the Twitter instance:
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(false);
cb.setOAuthConsumerKey(API_KEY);
cb.setOAuthConsumerSecret(API_SECRET);
cb.setOAuthAccessToken(ACCESS_TOKEN);
cb.setOAuthAccessTokenSecret(SECRET_KEY);
// enabling include_entities parameters
cb.setIncludeEntitiesEnabled(true);
Twitter twitterInstance = new TwitterFactory(cb.build()).getInstance();
Also, after enabling the entities, in the search string you have to had the condition "filter:images".
List<String> keywords = new ArrayList<String>();
keywords.add("#pet");
keywords.add("cat");
// String.join for Java 8
String twitterSearchString = "((" + String.join(" OR ", keywords) + ")";
// adding the filter condition
twitterSearchString += " AND filter:images)";
Query q = new Query(twitterSearchString);
And you will get just results with images (tested with twitter4j-core 4.0.4).
For filter in twitter API you can check official document for latest version as on date Apr 02 2019
https://developer.twitter.com/en/docs/tweets/search/guides/standard-operators.html
I am using google contacts service with .net mvc and I want to load 100 most contacted persons with ContactQuery.NumberToRetrieve and ContactQuery.OrderBy.
what should I set to OrderBy to make it work?
thanks a lot
query.OrderBy = "lastmodified";
query.SortOrder = "descending";
query.NumberToRetrieve = 1000 //Convert.ToInt32(ConfigurationManager.AppSettings["NumberToRetrieve"]);