У меня очень мало опыта в программировании, я просто учусь искать и пробовать. Я никогда раньше не имел дело с javascript, поэтому, пожалуйста, попробуйте конкретизировать.
Я ищу создание букмарклета для автоматизации загрузки видео. Это то, что я нашел до сих пор при поиске:
document.getElementsByClassName('class_name')[0].innerHTML
// used to output to console the value of the class
document.getElementsByClassName('class_name')[0].click()
// used to click on a specific class
function copyToClipboard(text) {
var dummy = document.createElement("textarea");
// to avoid breaking orgain page when copying more words
// cant copy when adding below this code
// dummy.style.display = 'none'
document.body.appendChild(dummy);
//Be careful if you use texarea. setAttribute('value', value), which works with "input" does not work with "textarea". – Eduard
dummy.value = text;
dummy.select();
document.execCommand("copy");
document.body.removeChild(dummy);
}
//The above is a function used to copy data to the clipboard.
Вот как я представляю, как это работает после нажатия на букмарклет:
copyToClipboard(document.getElementsByClassName('video_name')[0].innerHTML)
// this will copy the video name to the clipboard
document.getElementsByClassName('download_button')[0].click()
// this will click the download button which opens the resolutions list
document.getElementsByClassName('resolution')[0].click()
// this will click the top most resolution in the downloads list
Эточасть, где я застрял. Теперь открывается файловый менеджер, чтобы указать местоположение и имя для сохранения. Как реализовать букмарклет таким образом, чтобы он вставлял содержимое буфера обмена в поле «Имя файла» в проводнике файлов (он уже автоматически выбран в этом поле), а затем, как мне заставить его нажать кнопку «Сохранить».
Спасибо за помощь!