Обнаружил вашу ошибку:
Вы написали:
list.endsWith("/viewusp=sharing"))
вместо
list.endsWith("/view?usp=sharing"))
Было бы хорошей идеей поставить начало и конец URL в переменной и не повторять их.
$("#checklist").on("click", function () {
const start = "https://drive.google.com/file/d/"
const end = "view?usp=sharing"
var value = $("#uploadlist").val();
var arr= value.split(" ")
$.each(arr, function(key, list){
if (list.startsWith(start) & list.endsWith(end)) {
const id = list.replace(start,"").replace(end,"");
console.log(id);
}
});
//The rest of your code here
});