How to get a list of all disputes a person has via python telethon? - telegram

As far as I know, you can sparsize group members.
But he doesn’t write anything about contacts, if contacts can’t be how then to parse all correspondence?
And then launch a mailing list in them.
I already wrote about this in the article, but that code is not working

Related

Using LinkedIn API to retrieve advertising reports

I'm working on a simple app to programmatically retrieve ads performance within Linkedin. I have general API experience but this is the first time i get my feet wet with the Linkedin API.
One example from Linkedin API documentation suggest something that would get me started:
GET https://api.linkedin.com/v2/adAnalyticsV2?q=analytics&dateRange.start.month=1&dateRange.start.day=1&dateRange.start.year=2016&timeGranularity=MONTHLY&pivot=CREATIVE&campaigns=urn:li:sponsoredCampaign:112466001
I am encountering two problems:
First this example implies that you already know the campaign ID. However I am unable to find a way to retrieve a list of campaign ID's for a given account.
Second, if I manually pull a campaign ID, I receive an error: "{"serviceErrorCode":2,"message":"Too many fields requested. Maximum possible fields to request: 20","status":400}". Pretty clear error.
A little research tells me that by adding the parameter "&fields=" I will be able to limit my query to less than 20 field (I really need only a dozen anyway) but I can't find and documentation regarding the names of the fields available.
Any help or pointer will be appreciated.
please refer the link below scroll down where you ill see the field names mentioned as metrics , these are the fields.
https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads-reporting/ads-reporting?tabs=http#analytics-finder

How do I chain two Apify actors?

I need to scrape an URL list obtained by a Google search, using the Apify platform.
My plan is to start from a Google Search Scraper Actor task. However I don't think it can be used to scrape anything else than the Google search results (maybe I'm wrong ?). Therefore I need to provide its output to another Actor task, e.g. a Web Scraper or a Puppeteer Scraper.
But I can't seem to find the documentation related to the chaining of Actors. How should I proceed ?
Update :
I found How to pass data from crawler to actor, and setting an ACTOR.RUN.SUCCEEDED webhook on the Run task API endpoint of the second actor seems to work (that is, the second actor is launched).
However I can't seem to find how to pass the first actor's dataset to the second actor : the Start URLs field being mandatory I guess I should set it to the dataset, however the dataset link is different for each run…
You can chain multiple actor runs either via the Metamorph feature, or using Webhooks.
Metamorph
Metamorph allows you to run an actor and while the actor is running, "morph" it into a different actor with a custom input. The original actor will be stopped and replaced by the second one, but both will use the same storages, have the same run ID and will be displayed as a single actor run in the Apify app. You can use metamorph multiple times in a single run.
You can find the documentation for Metamorph here.
Webhooks
Webhooks allow you to call an arbitrary API endpoint once an actor reaches a given status, for example: SUCCEEDED. You can use this to call the Run Actor API to start another actor. You can set a custom payload for the webhooks, however, at this moment, passing output directly as webhook payload is not supported, so you'll need to use the ID of a key value store or dataset, where your results are stored and read it from there.
See the Webhooks docs here.
For example, to get the IDs of both key value store and dataset of the original actor, you would configure a payload like this:
{
"datasetId": {{resource.defaultDatasetId}},
"keyValueStoreId": {{resource.defaultKeyValueStoreId}}
}
Passing data from Google Search Scraper to Web Scraper
The task is not trivial because the Google Search output format is not compatible with the Web Scraper input format. The best way to do this is to create an intermediary actor that uses the output from Google Search Scraper to produce an input for Web Scraper and then metamorph into it. So the final flow is:
Google Search Scraper --webhook--> Output Processor Actor --metamorph--> Web Scraper.

Email Conversations / Email Threading support in EWS Managed Api (against Exchange 2010 or so)

The EWS Managed API has a handful of functions for retrieving and managing email conversations (aka email threads). Unfortunately, a large part of them work only against new versions of Exchange (2013 etc.)
Outlook does implement email threading against older versions of Exchange. Perhaps it does this by managing the threads by itself (Outlook is a desktop application, the emails are copied on the local machine, therefore they can be easily grouped by Conversation Topic etc.).
Now, how can email threading be supported within a web application? What is usually done for supporting this feature in an Exchange client? By supported I mean:
retrieve first 10 conversations snapshots, then retrieve the next 10 conversations snapshots - that is, support for paging (retrieve pages on demand) - this data would be used to build a master view
retrieve all emails within a conversation - that is, retrieve the children of a conversation on demand) - this data would be used to build a detail view of a conversation.
Issues with EWS Managed Api etc.:
there is no Conversation.Bind(conversationId) in EWS Managed API
ExchangeService.FindItems(filter for ConversationTopic == "some topic") is by no means reliable (because there may be different conversations having the same topic)
ExchangeService.FindItems(filter for ConversationId == "QWERYUIO") - I could not figure out how to use this :) Is it possible to search for emails by ConversationId?
functions like ExchangeService.GetConversationItems() are only "applicable for clients that target Exchange Online and versions of Exchange starting with Exchange Server 2013."
What I am using now (as a workaround):
retrieve (on demand) a page of conversations using ExchangeService.FindConversation()
for each conversation in the retrieved page, read the Conversation.GlobalIds property
build an aggregate (an array) containing the values from all GlobalIds - by concatenating Conversation.GlobalIds of all the conversations
make an Exchange call to bind the ids to emails (ExchangeService.BindToItems)
perform a group-by operation of the emails (conceptually, it is a grouping operation, but implementation is not a trivial group-by call - emails cannot be grouped by ConversationId, as that property is not available when working against Exchange 2010, though the documentation does not specify this)
use the data to build the UI in one step (the list of conversations for the master view, the groups of emails for the detail view of each conversation) etc.
Some issues with the implementation described above
I am retrieving a lot of data from the server when calling the ExchangeService.BindToItems operation - the performance is not excellent, but it is not quite bad either. Of course, it would have been better to retrieve the emails only when the user wants to access the detail view of a specific conversation. A possible hack: hold the GlobalIds array somewhere in a hidden field, then use it to fetch the emails in order to build the detail view. I know that a GET request is limited in size, but however...
On email conversations / email threading, nobody knows which supports what:
Here it says that FindConversation(ViewBase, FolderId) is applicable for clients that target Exchange Online and versions of Exchange starting with Exchange Server 2013. On the other hand, here is written that the ExchangeService.FindConversation() function can be used for Versions of Exchange starting with Exchange 2010, including Exchange Online.
This is funny, too: Applies to: EWS Managed API | Exchange Server 2010 Service Pack 1 (SP1), BUT Ensure that you have an Exchange 2013 or Exchange Online service account with a major version of 15 or higher. :)
Here it says that the Item.ConversationId property is available in Versions of Exchange starting with Exchange 2010, including Exchange Online. But it is not :)
Note: I am not very sure about the support of the Item.ConversationId, as I do not have the code at hand and cannot perform a test right now. Therefore, please forgive me if that property is available after all when using EWS Managed API against Exchange 2010.
All in all,
do you have any ideas for implementing the email conversations / email threading feature in a web application, using the EWS Managed API against an Exchange 2010 server?
Thank you a lot for having the patience to read such a long post :)
Some references:
http://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.exchangeservice_methods%28v=exchg.80%29.aspx
http://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.conversation_members%28v=exchg.80%29.aspx
http://msdn.microsoft.com/en-us/library/office/gg274407%28v=exchg.80%29.aspx
http://msdn.microsoft.com/en-us/library/office/jj220497%28v=exchg.80%29.aspx
Implementing Outlook 2010's group by conversation using EWS and Exchange 2007
Exchange Webservice Managed API - Find items by extended properties
I've addressed some of the documentation questions you had in the comments, so I'm going to attempt to answer your real coding questions here.
To get your master view, ExchangeService.FindConversation is the right method to use. It does support paging by limiting the results to the number of conversations specified by the view parameter. You could call it on demand to get older and older results.
To get your detailed view, because ExchangeService.GetConversationItems isn't available on Ex2010, you can use ExchangeService.FindItems with an IsEqualTo SearchFilter that searches for items with a matching ConversationId (see code below). There's more information about search filters here: How to: Use search filters with EWS in Exchange.
In the following method, I limited the properties of the FindItems call by specifying a property set, and not returning all the properties. If you wanted to return all the properties, you would just remove the line that sets the PropertySet.
static void forumFindConversationItem(ExchangeService service)
{
ItemView view = new ItemView(10);
//Remove the following line if you want to get all the properties for each message. This will limit the properties returned in your results (and save time).
view.PropertySet = new PropertySet(EmailMessageSchema.Subject, EmailMessageSchema.DateTimeReceived);
SearchFilter.IsEqualTo conversationFilter =
new SearchFilter.IsEqualTo(EmailMessageSchema.ConversationId, "AAQkADIwM2ZlM2ZlLWMwYjctNDg2Ny04MDU0LTVkMTFmM2IxY2ZjZQAQANEDR7V/30dphLiNOLSTuxE=");
FindItemsResults<Item> results = service.FindItems(WellKnownFolderName.Inbox, conversationFilter, view);
}
Once you have each ItemID (returned by the code above) you could use the Bind method to get all the properties on each item.
Hope that helps. I'll follow up when the versioning issues for the methods on MSDN have been updated.
More generally, there seems to be an issue with the ConversationID as it is popularly understood and actually used in Exchange itself. This could impact your (or anyone's) development.
I have been working on an email ticketing program in production and was using ConversationID to cluster emails together in a single thread for easy viewing.
But it now appears that there are emails that are not on the same thread -- yes, they share the same Subject and From Address and are sent around the same date/time -- but they do not occur in citation of each other (e.g. one email body in response to an older one is how many construe an "email thread") -- yet these disparate emails have the same exact ConversationID, even though one body has nothing to do with another.
In fact, even if the date/time is not close, for example, a "Thought of the Day" email from the same person, those will sometimes be grouped with the same ConversationID. This may sound useful in that case but is not so useful in the business case of a payroll person sending "RE: 401k".
To be clear, this is not a case-sensitive overmatch, an oversight I had when using Item.ExchangeID before (which is unique if you account for case). Even accounting for case, wholly different email threads have the exact same ConversationID.
This suggests to me one cannot depend upon ConversationID as a GROUP BY clause and must use some additional, custom-created code.

Connecting track names and artist names with Spotify Uris

I've found related questions (like this one), but nothing that directly answers my question: I need a direct way to turn artist name and track name into a spotify link. Just like spotify does for the local file list (some are links, some are not, I assume because spotify doesn't have those tracks.
How can I turn something like artist:'Francolin' and track name:'Hospital Song' into a Spotify uri without searching for it (which will return multiple results, and I don't know which one to use). How does the Spotify local files list do it?
The local files list in the Spotify client makes URLs like this:
spotify:local:Coldplay:Mylo+Xyloto:Paradise:277 (spotify:local:ARTIST:ALBUM:TRACK:LENGTH_IN_SECONDS). You can verify this by right-clicking a local file in your list that hasn't been linked to a Spotify track and choosing "Copy Spotify URI".
When playing the track, the client resolves it without using the backend at all - it searches its own local list of known files and plays whichever matches it closest.
When linking to a "real" Spotify track, the client asks the backend to do the dirty work. There isn't a web API for this (it's in libSpotify though), but basically the backend does a few heuristics to the data* then chooses the track that matches the given data (including length) the closest.
*Basically, the track metadata is stripped to a simpler form when searching, and the album has less weighting since an artist may release the same track on multiple albums.
I ran into the same problem as you but I don't think there's a direct way to convert it. Instead I just run for a search with "artist:'$artist' title:'$title'", which should be very accurate, and just use the first result in the array of results.

Counting Likes and shared times in google reader public profile

We've collected a list of google reader profiles of our members and now I want to make a hot list board and show the most shared and the most liked items to be shared with our members.
I've checked a couple of unofficial google reader APIs but I did not find anything related to the like or sharing.
do you know how can I count the number of likes for each feed item in the shared profile of our members?
Likes are exposed in the Atom feed for the shared items as gr:likingUser elements (one per user who liked the item, up to 100). Additional likers (and their profile information) can be fetched by making a GET request to http://www.google.com/reader/api/0/item/likers?i=. http://blog.persistent.info/2009/07/exporting-likes-from-google-reader.html has more information.

Resources