Last active
January 22, 2021 07:48
-
-
Save alexgoryushkin/79b0345a8c5c81e77cfa192201d5fc89 to your computer and use it in GitHub Desktop.
Скачать все документы с vk.com/docs / Download all documents from vk.com/docs
This file contains hidden or 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
1) Ввести поисковый запрос / Enter a search query | |
2) Прокрутить страницу до конца (можно выполнить следующую команду из консоли несколько раз) / | |
Scroll to the end of the page (you can run the following command from the console several times) | |
window.scrollTo(0,document.body.scrollHeight); | |
3) Затем следующий скрипт будет скачивать файл раз в 3 секунды. Но к сожалению он может прерваться, | |
если пользователь разместивший файл был заблокирован. | |
Тогда можно выполнить алгоритм заново, но изменить переменную "start", чтобы не скачивать уже загруженные файлы. / | |
Then the next script will download the file every 3 seconds. But unfortunately it may interrupt if | |
the user who posted the file was blocked. | |
Then you can run the algorithm again, but change the "start" variable so that | |
you don't download files that have already been downloaded. | |
let found_count = intval(document.getElementById("docs_search_summary").textContent); | |
let docs = document.getElementsByClassName("docs_item_icon docs_icon_type8"); | |
console.log("Docs count: " + docs.length); | |
let start = 0; | |
for (var i=start;i<docs.length;i++) { | |
(function(ind) { | |
setTimeout(function(){docs[ind].click(); console.log(ind + " " + docs[ind].href);}, 1000 + (3000 * (ind-start))); | |
})(i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment