📜 ⬆️ ⬇️

Saving contact information from sites

Good afternoon, colleagues!

Once upon a time, without having a full account on Habre, I wrote an article in the sandbox, hoping to get an invite. I didn't get an invite, and I thought the article went nowhere. Today, looking through the Google App Engine logs, I found a link from the site, which turned out to be my article from the sandbox. Leaving behind the question of the correctness of such a publication, I want to thank the kind people I did not know from the ajc.su website for saving my article for me. :) But, actually, on the topic.

The first time the idea came to me when I needed to rent an apartment. I looked through the ads on Cyan and called back the most interesting ones. After a couple of calls, I realized that it was necessary to somehow arrange telephone calls - to save not only numbers, but also addresses, and at the same time descriptions of apartments. At this point, I realized that with all the development of the Internet, contact information still had to be processed by hand — at best, block by block and stored somewhere. Given that the contact is an object similar to, for example, a calendar. But if the button “Add an event to the calendar” already exists on many sites, then I have not yet seen the button “Add a contact to the address book”. I decided to fill this gap, and I want to share the results of my thoughts and ideas.

Who needs it?

The first thing that I thought about, realizing the problem - and it is relevant for someone other than myself. Common sense suggested that there must be someone else besides me, for whom this problem is relevant, it remains only to understand who these people are.
')
From my own experience - this is apparently the tenants of apartments in the search for proposals on the sites. Surely the realtors themselves who view the ads in the same way will be interested. Another big group is headhunters and HRs. These are all people who regularly have new contacts that need to be contacted (call and write) repeatedly.

I think that there are other groups of people who would be interested to have such an opportunity.

General approach

In the task of processing contacts from the site, I see two steps:

  1. Getting contact information from the site
  2. Contact Manipulation


The task of the first stage can be solved in three ways:

  1. Parser page by reference
  2. Link script for the site
  3. Browser Plugin


At the second stage, the obtained contact information can be:

  1. Show as QR code
  2. Save as vCard file
  3. Forward as vCard via SMS
  4. Save to Google Contacts
  5. Save to MS Exchange Notebook
  6. Use for VoIP-call


I think that this is not a complete list, but at least I have listed the main possible actions.

Getting contact information

The initial idea was to allocate phone numbers heuristically using various patterns. But this is an unreliable method — not every sequence of numbers, even if it looks like a telephone number, is one. In addition, it is not at all possible for me to select heuristically names and addresses.
Currently, I see the most promising analysis of the hCard markup. Firstly, in this markup the contact information is already structured, and secondly, it is promoted by Yandex . Although, of course, this approach involves a certain cooperation on the part of webmasters - the responsibility for marking up contact information falls on them.

Parser page by reference

This method seems to me not very convenient. First, the page with contact information will be requested twice - the first time by the user to see its contents, and the second time by the server to get contact from this page. This somewhat increases the load on the server hosting the requested page and distorts the attendance statistics. Secondly, this method does not apply to pages of sites that are shown only to authorized users. However, this approach is already implemented here . The author of this service is Tantek Çelik, one of the co-authors of the hCard microformat.

Link script for the site

This method of obtaining contact information involves placing JavaScript on the site (for example, in the form of a plug-in to jQuery), which scans the page for hCard markup on it and adding links to it to transfer the received contact for further processing.
With this approach, the contact can be selected from any page - accessible only to authorized users, or dynamically generated. True, this approach involves a great cooperation from the webmaster - it is assumed that he not only does hCard markup, but also places the script on the site.

Browser Plugin

This approach is similar to the previous one, but with the difference that the script selecting the contact from the page markup does not work in the context of the site page, but in the context of the browser. It allows the user to get contact from any pages containing hCard markup. The disadvantage of the approach is the need to create plug-ins for all popular browsers (Chrome, FF, IE, Opera), despite the fact that the plug-in systems are different. Although not so long ago, here, on Habré, an article about the framework ran through, allowing you to create plugins for all browsers at once.

Contact Manipulation

The contact obtained in one way or another can be further processed in some way. Methods of processing (hereinafter - actions) for myself, I divide into two groups:

  1. Save
  2. Call / Contact


At the moment I imagine how to implement the actions of the Save group. The actions of the group “Call” I put it off for later, for a more detailed study.

Show QR Code

This action involves converting the received contact to a vCard, and then encoding it into a QR code. The easiest way to code is to use the Google Charts API . All that is required is to create a link to the Google service, specifying the line containing the VCard-representation of the contact as one of the parameters.

Save VCF file

The action also involves converting the contact to vCard, and then sending it as a server response with the corresponding headers to the browser.

Save to Google Contacts

This action is somewhat more complicated than the previous ones, since it will require not only converting the contact to the XML format GData (an element of the Contact type), but also processing the authorization of access to Google Contacts via OAuth. This, as it turned out, is not so difficult, but the documentation available on Google Developers on this issue is not very intelligible. I intend to devote a separate article to this issue.

A few words in conclusion

I translated all my thoughts into a prototype service , which I called Act4Contact. He is now working on Google App Engine (and I am afraid that the free version of the service is unlikely to withstand the blog effect and not exceed the quota), there are no interface beauties in it and the AJAX interface that has now become the de facto standard, but it can already Your main task is to form a contact from the hCard markup and save it.

I plan to develop this service and bring it to working condition, in this connection I will be glad if someone becomes interested and is ready to join efforts with me in this direction. I would also be interested to receive feedback from webmasters - I suppose that the presentation of contact information in the form of a “manipulable” object should increase the conversion due to the fact that for the user the contact page will not be the last, after which its interaction with the site goes from the virtual plane to the physical (dial the phone number), but continues the interaction and makes it smoother. Therefore, I invite those who are interested to conduct a joint experiment on transforming contact information from a text form into an object-manipulative one and see how justified it is.

And further. During the work on this task, I already had several topics that I can share. For example, talk about working with the Google Contacts API. I think that continuing to work on the service will give more than one topic in order to share it with you.

UPD : According to the results of the discussion of the idea, a project team was formed consisting of me, Strange_R and another person. If there are still willing to join - write in a personal.

Source: https://habr.com/ru/post/147126/


All Articles