- Step 1
- Name, date of birth, city. According to these fields, we are looking for matches among Vkontakte accounts that have photos. In case we find 2 or more accounts, we use the one with the most recent login date. If nothing is found, go to Step 2.
- Step 2
- Using data by last name and first name, date of birth, we re-search.
If we find 2 or more accounts, go to Step 3.2. If nothing is found, go to Step 3.3.
- Step 3
- We are looking for the 10 most popular groups of the selected city of Vkontakte.
- In these groups we are looking for FI, date of birth, country Russia, there is a photo. If something is found, then save the current result, otherwise go to step 3.3.
- We are looking for groups by FI, country Russia, there is a photo. If something is found, we save the result, otherwise it is "empty".
var name = Args.fullname; var birth_day = Args.birth_day; var birth_month = Args.birth_month; var birth_year = Args.birth_year; var city = Args.city; var fields = "photo_id, sex, bdate, city, country, home_town, photo_max_orig, contacts, site, education, universities, schools, status, last_seen, followers_count, common_count, occupation, nickname, relatives, relation, personal, connections, exports, activities, interests, music, movies, tv, books, games, about, quotes, can_post, can_see_all_posts, can_see_audio, can_write_private_message, can_send_friend_request, is_favorite, is_hidden_from_feed, timezone, screen_name, maiden_name, career, military"; var countGroups = 10; var res = []; var item = {}; var city_id = 0; if (city != "") { city_id = API.database.getCities({"q": city, "country_id": 1}).items@.id[0]; } if (birth_day != "" && city_id > 0) { item = API.users.search({ "q": name, "country":1, "city": city_id, "has_photo":1, "fields": fields, "birth_day": birth_day, "birth_month": birth_month, "birth_year": birth_year }).items; var i = 0; while (i < item.length) { var item_ = item[i]; item_.criterion = " , , "; item_.step = "1.1"; res.push(item_); i = i +1; } } else { countGroups = countGroups + 1; } if (item.length > 0) { return res; } if (birth_day != "") { item = API.users.search({ "q": name, "country": 1, "has_photo": 1, "fields": fields, "birth_day": birth_day, "birth_month": birth_month, "birth_year": birth_year }).items; var i = 0; while (i < item.length) { var item_ = item[i]; item_.criterion = " , "; item_.step = "2.1"; res.push(item_); i = i +1; } } if (item.length > 0) { return res; } if (city.length > 0) { var groupsIDs = API.groups.search({ "q": city, "sort": 6, "type": "page", "count": countGroups }).items@.id; var count = 0; while (count < groupsIDs.length) { var item2 = {}; if (birth_day != "") { item2 = API.users.search({ "q": name, "country":1, "has_photo":1, "fields": fields, "birth_day": birth_day, "birth_month": birth_month, "birth_year": birth_year, "group_id": groupsIDs[count] }).items; } if (item2.length > 0) { var i = 0; while (i < item2.length) { var item_ = item2[i]; item_.criterion = " , , "; item_.step = "3.2"; item_.groupID = groupsIDs[count]; res.push(item_); i = i +1; } } else { item2 = API.users.search({ "q": name, "country":1, "has_photo":1, "fields": fields, "count": 5, "group_id": groupsIDs[count] }).items; var i = 0; while (i < item2.length) { var item_ = item2[i]; item_.criterion = ", "; item_.step = "3.3"; item_.groupID = groupsIDs[count]; res.push(item_); i = i +1; } } count = count + 1; } } return res;