/** * Scraper: AniWanTV Mobile - In-App Anime Streaming & Manga Reader Scraper * Author: Vamz Spectre (vamxapi.my.id) * Description: Scraper konten asli di dalam APK AniWanTV (Streaming Anime, Video Player, Komik/Manga Reader, Chapter Images, Search) * * Usage: * curl -sL "https://code.vamxapi.my.id/snippet/raw/aniwantv-content" -o aniwantv-content.js * node aniwantv-content.js * node aniwantv-content.js "anime" * node aniwantv-content.js "komik" * node aniwantv-content.js "search:solo leveling" * node aniwantv-content.js "https://komikindo.ch/remonster-chapter-124/" * node aniwantv-content.js "https://otakudesu.fit/tensei-goblin-dakedo-shitsumon-aru-episode-5-subtitle-indonesia/" */ const axios = require('axios'); const cheerio = require('cheerio'); const HEADERS = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36', 'Accept-Language': 'id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' }; const ANIME_BASE = 'https://otakudesu.fit'; const COMIC_BASE = 'https://komikindo.ch'; /** * Mengambil daftar anime ongoing / rilis terbaru dari feed AniWanTV */ async function getLatestAnime() { const res = await axios.get(ANIME_BASE, { headers: HEADERS, timeout: 15000 }); const $ = cheerio.load(res.data); const anime = []; $('article').each((_, el) => { const title = $(el).find('h2').text().trim(); const url = $(el).find('a').first().attr('href') || ''; const thumb = $(el).find('img').first().attr('src') || ''; const episode = $(el).find('.epz, .bt .ep').text().trim() || 'Ongoing'; const releaseTime = $(el).find('.time, time').text().trim() || null; if (title && url) { anime.push({ title, episode, releaseTime, url, thumb }); } }); return anime; } /** * Mengambil detail episode anime, iframe streaming video player, dan link download */ async function getAnimeEpisode(url) { const res = await axios.get(url, { headers: HEADERS, timeout: 15000 }); const $ = cheerio.load(res.data); const title = $('h1.entry-title, h1').first().text().trim() || 'Episode Anime'; const thumb = $('.fotoanime img, img.wp-post-image, .thumb img').first().attr('src') || null; const synopsis = $('.sinopc, .entry-content p').first().text().trim() || null; const streamIframe = $('iframe').first().attr('src') || null; const downloads = []; $('a').each((_, el) => { const href = $(el).attr('href'); const text = $(el).text().trim(); if (href && (href.includes('gofile') || href.includes('pixeldrain') || href.includes('drive') || href.includes('mega') || href.includes('mediafire') || href.includes('krakenfiles'))) { downloads.push({ server: text || 'Mirror Download', url: href }); } }); const episodes = []; $('a').each((_, el) => { const href = $(el).attr('href'); const epTitle = $(el).text().trim(); if (href && href.includes('-episode-') && !href.includes('facebook') && !href.includes('twitter') && !href.includes('whatsapp') && !href.includes('t.me')) { if (!episodes.some(e => e.url === href) && epTitle && !epTitle.toLowerCase().includes('cancel')) { episodes.push({ title: epTitle.replace(/\s+/g, ' '), url: href }); } } }); return { title, thumb, synopsis, streamIframe, downloads, episodes }; } /** * Mengambil daftar komik terbaru dari feed AniWanTV */ async function getLatestComics(page = 1) { const url = page === 1 ? `${COMIC_BASE}/komik-terbaru/` : `${COMIC_BASE}/komik-terbaru/page/${page}/`; const res = await axios.get(url, { headers: HEADERS, timeout: 15000 }); const $ = cheerio.load(res.data); const comics = []; $('.animepost').each((_, el) => { const link = $(el).find('a[itemprop="url"]').first(); if (!link.length) return; const title = link.attr('title')?.replace(/^Komik\s+/i, '').trim() || link.text().trim(); const href = link.attr('href') || ''; const image_url = $(el).find('img[itemprop="image"]').attr('src') || ''; const type = $(el).find('span[class*="typeflag"]').attr('class')?.split(' ').pop() || 'Manga'; const is_colored = $(el).find('div.warnalabel').length > 0; const is_hot = $(el).find('span.hot').length > 0; const ch = $(el).find('div.lsch a').first(); const latest_chapter = ch.text().trim() || 'N/A'; const chapter_url = ch.attr('href') || ''; const update_time = $(el).find('span.datech').text().trim() || 'N/A'; comics.push({ title, type, is_colored, is_hot, latest_chapter, update_time, url: href, chapter_url, image_url }); }); return comics; } /** * Mengambil detail komik dan seluruh daftar chapter */ async function getComicDetails(comicUrl) { const res = await axios.get(comicUrl, { headers: HEADERS, timeout: 15000 }); const $ = cheerio.load(res.data); const title = $('.entry-title, h1.entry-title').first().text().replace(/^Komik\s+/i, '').trim(); const image_url = $('.thumb img').first().attr('src') || ''; const rating = $('.archiveanime-rating i').first().text().trim() || 'N/A'; const status = $('.spe span:contains("Status")').text().replace(/Status\s*:\s*/i, '').trim() || 'N/A'; const author = $('.spe span:contains("Pengarang")').text().replace(/Pengarang\s*:\s*/i, '').trim() || 'N/A'; const type = $('.spe span:contains("Jenis Komik") a').text().trim() || 'N/A'; const synopsis = $('.komik_info-description-sinopsis p, .entry-content-single p').text().trim() || ''; const genres = []; $('.genre-info a, .spe span:contains("Genre") a').each((_, el) => { const g = $(el).text().trim(); if (g && !genres.includes(g)) genres.push(g); }); const chapters = []; $('.eps_lst li, #chapter_list li').each((_, el) => { const chLink = $(el).find('a').first(); const chTitle = chLink.find('.lchx, .chapternum').text().trim() || chLink.text().trim(); const chUrl = chLink.attr('href') || ''; const chDate = $(el).find('.dt, .date').text().trim() || ''; if (chUrl) { chapters.push({ title: chTitle, url: chUrl, update_time: chDate }); } }); return { title, image_url, rating, status, author, type, genres, synopsis, chapters_count: chapters.length, chapters }; } /** * Mengambil semua gambar lembaran komik dari satu chapter (Manga Reader) */ async function getChapterImages(chapterUrl) { const res = await axios.get(chapterUrl, { headers: HEADERS, timeout: 15000 }); const $ = cheerio.load(res.data); const title = $('.entry-title, h1').first().text().trim(); const images = []; $('#chimg-auh img, .reader-area img').each((i, el) => { const src = $(el).attr('src') || $(el).attr('data-src') || ''; const alt = $(el).attr('alt') || `Halaman ${i + 1}`; if (src && !images.some(img => img.url === src)) { images.push({ page: images.length + 1, url: src, alt }); } }); const nextChapter = $('.nextprev a.next, a[rel="next"]').attr('href') || null; const prevChapter = $('.nextprev a.prev, a[rel="prev"]').attr('href') || null; return { title, total_pages: images.length, navigation: { prev: prevChapter, next: nextChapter }, images }; } /** * Mencari komik di KomikIndo */ async function searchComics(query) { const url = `${COMIC_BASE}/?s=${encodeURIComponent(query)}`; const res = await axios.get(url, { headers: HEADERS, timeout: 15000 }); const $ = cheerio.load(res.data); const results = []; $('.animepost').each((_, el) => { const link = $(el).find('a[itemprop="url"]').first(); const title = link.attr('title')?.replace(/^Komik\s+/i, '').trim() || link.text().trim(); const href = link.attr('href') || ''; const image_url = $(el).find('img[itemprop="image"]').attr('src') || ''; const type = $(el).find('span[class*="typeflag"]').attr('class')?.split(' ').pop() || 'Unknown'; if (title && href) { results.push({ title, url: href, image_url, type }); } }); return results; } /** * Router utama fungsi scraper */ async function scrapeAniWanTV(input = '') { const query = (input || '').trim(); try { // 1. Chapter Images reader if (query.includes('chapter-') || query.includes('/chapter/')) { const data = await getChapterImages(query); return { status: true, creator: 'Vamz Spectre', type: 'chapter_reader', data }; } // 2. Comic Details if (query.includes('komikindo.ch/komik/')) { const data = await getComicDetails(query); return { status: true, creator: 'Vamz Spectre', type: 'comic_details', data }; } // 3. Anime Episode Stream & Download if (query.includes('otakudesu') && query.includes('-episode-')) { const data = await getAnimeEpisode(query); return { status: true, creator: 'Vamz Spectre', type: 'anime_episode_stream', data }; } // 4. Search Anime & Komik if (query.startsWith('search:') || (query.length > 0 && !['anime', 'komik', 'all'].includes(query.toLowerCase()))) { const q = query.replace(/^search:\s*/i, ''); const comics = await searchComics(q); return { status: true, creator: 'Vamz Spectre', type: 'search_results', query: q, total: comics.length, data: { comics } }; } // 5. Anime Only if (query.toLowerCase() === 'anime') { const anime = await getLatestAnime(); return { status: true, creator: 'Vamz Spectre', type: 'anime_feed', total: anime.length, data: anime }; } // 6. Komik Only if (query.toLowerCase() === 'komik') { const comics = await getLatestComics(1); return { status: true, creator: 'Vamz Spectre', type: 'comic_feed', total: comics.length, data: comics }; } // 7. Default Dashboard Feed (Anime + Komik) const [anime, comics] = await Promise.all([ getLatestAnime().catch(() => []), getLatestComics(1).catch(() => []) ]); return { status: true, creator: 'Vamz Spectre', type: 'in_app_dashboard', data: { ongoing_anime: anime.slice(0, 10), latest_comics: comics.slice(0, 10) } }; } catch (error) { return { status: false, creator: 'Vamz Spectre', error: error.message || 'Gagal mengambil data dari AniWanTV APK content provider' }; } } module.exports = scrapeAniWanTV; // CLI Runner if (require.main === module) { const param = process.argv[2] || ''; scrapeAniWanTV(param) .then(res => console.log(JSON.stringify(res, null, 2))) .catch(err => { console.error(JSON.stringify({ status: false, error: err.message }, null, 2)); process.exit(1); }); }