fix: extract anime title from URL and download all episodes on follow
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user