Skip to content

Instantly share code, notes, and snippets.

@yurtaev
Created November 12, 2011 21:23
Show Gist options
  • Save yurtaev/1361137 to your computer and use it in GitHub Desktop.
Save yurtaev/1361137 to your computer and use it in GitHub Desktop.
vkontakte: get all history messages for user (JSON)
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);
@alexey-shaposhnikov
Copy link

@DenDog1
Copy link

DenDog1 commented Feb 19, 2019

is there a way to execute this using the Termux app? Running in Android 9 note 9 with AARCH64...would love to know...thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment