📜 ⬆️ ⬇️

Exporting birthdays from VKontakte (working with OpenAPI)

image Personally, I am not a fan of social networks, and in particular - VKontakte, because of which I had a lot of time wasted. Actually, therefore, at one time I decided to retire from it. But at a certain point, I realized that the contact served not only as a place where I could press F5 on the News page from morning to night , but also as a service, thanks to which I could find out in time about the birthdays of friends and, thus, maintain they have a good relationship.

Thus, the task was set: exporting the calendar to an external service (in my case, Google Calendar). The native API is used, so everything works quickly and without bugs. Who cares - I ask under the cat.

So, the following options were considered:

Variant in the forehead - write a script that collects answers to AJAX requests for the calendar page. In general, bypassing security problems, half an hour over Firebug server responses, creating php-shki - and it turned out a file with formatted HTML blocks, from which you also need to calculate the year of birth from the age in brackets, and, of course, even HTML is "not really" valid. Option disappeared. Then the work went, and there was no time + desire to look for other options.
')
Soon on Habré, an article “Exporting Birthdays from vKontakte to Google Calendar” appeared , which offered a similar solution, only as a user script, and with jQuery pushed inside. Well, okay, I thought, what is slowing down is not very scary, the main thing is working. Unfortunately, a couple of unpleasant bugs were discovered (including problems with special characters in names, a limit of one person per day), and this option also disappeared.

Yesterday, from unwillingness to do anything useful, I decided to return to the question. Since at this point the contact already has a more or less normal API for external sites and js applications ( OpenAPI ), it was decided to use it. A couple of hours of proceedings, regret that there is no analogue of FQL or social graph, then disassembling with the iCalendar format - and thus, the simplest HTML file and contact application (in order not to load the server) was created that allows you to get ics- file for later import into any popular calendar program.

You can view and download the "page" here: http://pastebin.com/Q4dwGQyL
If you are too lazy to create your application on VKontakte and just want to use a ready-made solution, you can try it here: http://rreverser.com/dev/vkcal.htm (I warn you, hosting is free, so it can not withstand the famous effect).

Method of use:Thanks, bye everyone.

Note : the script was written by my friend RReverser.

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


All Articles