Files
youtube-dl/static/youtube-dl_thumbnail.js

30 lines
736 B
JavaScript
Raw Normal View History

2022-04-30 18:57:23 +09:00
'use strict';
const url = document.getElementById('url');
const download_btn = document.getElementById('download_btn');
// 다운로드
download_btn.addEventListener('click', (event) => {
2022-04-30 18:57:23 +09:00
event.preventDefault();
if (!url.value.startsWith('http')) {
notify('URL을 입력하세요.', 'warning');
return;
}
2022-04-30 18:57:23 +09:00
fetch(`/${package_name}/ajax/thumbnail`, {
method: 'POST',
cache: 'no-cache',
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
},
body: get_formdata('#download'),
})
.then((response) => response.json())
.then(() => {
notify('분석중..', 'info');
})
.catch(() => {
notify('다운로드 요청 실패', 'danger');
});
});