Isla Chan - Sharing
Isla Chan - Sharing
June 13, 2025 at 03:50 AM
// Fitur Netflix Trending // type case // sumber Scrape : https://whatsapp.com/channel/0029Vb5EZCjIiRotHCI1213L/247 // janlup follow 🥰 https://whatsapp.com/channel/0029Vb5owDXKAwEryaIdYk36 case 'topnetflix': case 'netflixtrending': { const fetch = require('node-fetch') const fs = require('fs') const netflixTrending = async () => { const religion = [ "/id", "/id-en" ] const netflixUrl = "https://www.netflix.com" + religion[0] // bisa ubah ke [1] kalau mau versi English const response = await fetch(netflixUrl) if (!response.ok) throw Error(`Request error: ${response.status} ${response.statusText}\n${await response.text()}`) const html = await response.text() const jsonString = html.match(/reactContext = (.*?);/)?.[1] if (!jsonString) throw Error(`Tidak menemukan data pada Netflix`) const cleaned = jsonString.replace(/\\x([0-9A-Fa-f]{2})/g, (_, hex) => String.fromCharCode(parseInt(hex, 16))) const json = JSON.parse(cleaned) const movieAndShow = Object.entries(json.models.graphql.data).filter(v => !v?.[1]?.__typename.match(/Genre|Query/)) const result = movieAndShow.map(([_, v]) => { const genreList = v.coreGenres.edges.map(v => v.node.__ref) return { title: v.title, latestYear: v.latestYear, videoId: v.videoId, shortSynopsis: v.shortSynopsis, contentAdvisory: v.contentAdvisory?.certificationValue || "-", genre: genreList.map(ref => json.models.graphql.data[ref]?.name || '').join(", "), type: v.__typename, url: netflixUrl + "/title/" + v.videoId, poster: v['artwork({\"params\":{\"artworkType\":\"BOXSHOT\",\"dimension\":{\"width\":200},\"features\":{\"performNewContentCheck\":false,\"suppressTop10Badge\":true},\"format\":\"JPG\"}})']?.url } }) return result } try { const trending = await netflixTrending() const formatted = trending.slice(0, 10).map((v, i) => `📺 *${v.title}* (${v.latestYear}) 🎞️ Tipe: ${v.type} 🔞 Rating: ${v.contentAdvisory} 🎭 Genre: ${v.genre} 📝 Sinopsis: ${v.shortSynopsis} 🔗 ${v.url} 🖼️ Poster: ${v.poster}`).join('\n\n') m.reply(`*🎬 Netflix Trending Saat Ini:*\n\n${formatted}`) } catch (err) { m.reply('⚠️ Gagal mengambil data Netflix!\n\n' + err.message) } } break

Comments