Created
November 12, 2011 21:23
-
-
Save yurtaev/1361137 to your computer and use it in GitHub Desktop.
vkontakte: get all history messages for user (JSON)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jq = document.createElement('script'); | |
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
var id = prompt("Введите ID пользователя", "0"); | |
var data = null; | |
var messages = {}; | |
messages[id] = []; | |
function getHistory() { | |
var viewer = $("<div></div>").attr({ | |
'id': 'viewer' | |
}); | |
$(viewer).css({ | |
"position": "fixed", | |
"top": "25%", | |
"left": "25%", | |
"border-radius": 10, | |
"z-index": 100 | |
}); | |
$(viewer).appendTo("body"); | |
$('<textarea rows="10" cols="40" id="viewer_history">').appendTo("#viewer"); | |
$.ajax({ | |
url: "http://vkontakte.ru/al_im.php", | |
type: "POST", | |
data: ({'act' : 'a_history', | |
'al': '1', | |
'peer': id, | |
'whole': '1'}), | |
success: function(msg) { | |
data = msg; | |
var temp = $("<div id='temp'></div>").css({ | |
"display": "none" | |
}); | |
$(temp).html(data); | |
$(temp).appendTo("body"); | |
$.each($("#temp tr"), function(index, msg) { | |
msg_id = $(msg).attr("id"); | |
messages[id].push({ | |
"id": $(msg).attr('id'), | |
"text": $("#" + msg_id + " .wrapped").clone().children().remove().end().text(), | |
"date": $(msg).attr('date'), | |
"from": $(msg).find('.im_log_author_chat_name a').text(), | |
"from_url": $(msg).find('.im_log_author_chat_name a').attr("href") | |
}); | |
}); | |
$("#viewer_history").val(JSON.stringify(messages)); | |
} | |
}); | |
} | |
setTimeout(getHistory, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
is there a way to execute this using the Termux app? Running in Android 9 note 9 with AARCH64...would love to know...thanks