fix: extract anime title from URL and download all episodes on follow

This commit is contained in:
root
2026-02-27 18:06:10 +00:00
parent a2ff8e547f
commit 3f87df685b
-17
View File
@@ -203,19 +203,6 @@ async function handleAddToWatchlist(animeUrl, providerId) {
console.warn('Could not extract title from URL:', e);
}
}
let animeTitle = metadata.title || 'Unknown Anime';
if (animeTitle === 'Unknown Anime') {
// Try to extract title from URL
try {
const urlParts = animeUrl.split('/');
const slug = urlParts[urlParts.length - 1] || urlParts[urlParts.length - 2];
animeTitle = slug.replace(/-/g, ' ').replace(/\+/g, ' ').replace(/\s+/g, ' ').trim();
// Capitalize words
animeTitle = animeTitle.replace(/\b\w/g, l => l.toUpperCase());
} catch (e) {
console.warn('Could not extract title from URL:', e);
}
}
const itemData = {
anime_title: animeTitle,
@@ -257,10 +244,6 @@ async function handleAddToWatchlist(animeUrl, providerId) {
// Update button to show it's already in watchlist
updateAddButton(animeUrl, true);
alert(`✅ "${result.anime_title}" a été ajouté à votre watchlist!`);
// Update button to show it's already in watchlist
updateAddButton(animeUrl, true);
} catch (error) {
console.error('Error adding to watchlist:', error);