diff --git a/websites/0-9/1Flex/metadata.json b/websites/0-9/1Flex/metadata.json new file mode 100644 index 000000000000..777b4c4b66f7 --- /dev/null +++ b/websites/0-9/1Flex/metadata.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://schemas.premid.app/metadata/1.16", + "apiVersion": 1, + "author": { + "id": "1171471152695214094", + "name": "ownernotfound" + }, + "service": "1Flex", + "description": { + "en": "The 1 Stop of Everything, Discover and watch amazing movies and TV shows" + }, + "url": "www.1flex.nl", + "regExp": "^https?[:][/][/](www[.])?1flex[.]nl[/]", + "version": "1.0.0", + "logo": "https://i.imgur.com/lZe2Tbj.png", + "thumbnail": "https://i.imgur.com/h7ugqHB.png", + "color": "#E53935", + "category": "videos", + "tags": [ + "movies", + "anime", + "tv", + "torrent", + "games", + "livetv", + "sports" + ], + "settings": [ + { + "id": "privacy", + "title": "Privacy Mode", + "icon": "fas fa-user-secret", + "value": false + } + ] +} diff --git a/websites/0-9/1Flex/presence.ts b/websites/0-9/1Flex/presence.ts new file mode 100644 index 000000000000..29852ff3bc86 --- /dev/null +++ b/websites/0-9/1Flex/presence.ts @@ -0,0 +1,178 @@ +import { ActivityType, Assets } from 'premid' + +const presence = new Presence({ + clientId: '1452924221742387362', +}) + +const browsingTimestamp = Math.floor(Date.now() / 1000) + +enum ActivityAssets { + Logo = 'https://i.imgur.com/lZe2Tbj.png', +} + +presence.on('UpdateData', async () => { + let presenceData: PresenceData = { + largeImageKey: ActivityAssets.Logo, + startTimestamp: browsingTimestamp, + details: 'Unsupported Page', + } + + const { pathname } = document.location + + const privacy = await presence.getSetting('privacy') + + if (privacy) { + presenceData.details = 'Watching 1Flex' + presence.setActivity(presenceData) + return + } + + const pages: Record = { + '/': { + details: 'Viewing HomePage', + smallImageKey: Assets.Viewing, + }, + '/tv-shows': { + details: 'Browsing TV Shows', + smallImageKey: Assets.Viewing, + }, + '/movies': { + details: 'Browsing Movies', + smallImageKey: Assets.Viewing, + }, + '/manga-read': { + details: 'Reading Manga', + smallImageKey: Assets.Viewing, + }, + '/live-tv': { + details: 'Browsing Live TV', + smallImageKey: Assets.Viewing, + }, + '/sports': { + details: 'Watching Live Sports', + smallImageKey: Assets.Viewing, + }, + '/torrent': { + details: 'Browsing Torrents', + smallImageKey: Assets.Viewing, + }, + '/my-list': { + details: 'Checking My List', + smallImageKey: Assets.Viewing, + }, + '/browse-by-languages': { + details: 'Browsing Content By Language', + smallImageKey: Assets.Viewing, + }, + } + + for (const [path, data] of Object.entries(pages)) { + if (pathname === path) { + presenceData = { + ...presenceData, + ...data, + type: ActivityType.Watching, + } + } + } + + if (pathname === '/play') { + const params = new URLSearchParams(location.search) + const type = params.get('type') + if (type === 'movie') { + presenceData.type = ActivityType.Watching + presenceData.details = '1Flex' + const title = document.querySelector('h3.text-white.font-bold')?.textContent?.trim() || 'Unknown Movie' + const year = document.querySelector('.text-zinc-400 span')?.textContent?.trim() || 'N/A' + const runtime = document.querySelectorAll('.text-zinc-400 span')[1]?.textContent?.replace('min', '')?.trim() || 'N/A' + const rating = document.querySelector('.text-yellow-500 + span')?.textContent?.trim() || 'N/A' + const poster = document.querySelector('img.object-cover.rounded-lg')?.getAttribute('src') + presenceData.name = title + presenceData.state = `⭐ ${rating} 🕒 ${runtime} mins 🗓️ ${year}` + if (poster) + presenceData.largeImageKey = poster + presenceData.smallImageKey = ActivityAssets.Logo + } + if (type === 'tv') { + presenceData.type = ActivityType.Watching + const params = new URLSearchParams(location.search) + const season = params.get('season') || '?' + const episode = params.get('episode') || '?' + const activeEpisode = document.querySelector('[data-episode].bg-gradient-to-r') || document.querySelector(`[data-episode="${episode}"]`) + const episodeTitle = activeEpisode?.querySelector('.font-semibold')?.textContent?.trim() || `Episode ${episode}` + let runtime = 'N/A' + const metaElements = activeEpisode?.querySelectorAll('.text-xs, .text-sm') + metaElements?.forEach((el) => { + const text = el.textContent || '' + if (text.includes('min')) { + runtime = text.match(/(\d+)\s*min/i)?.[1] || 'N/A' + } + }) + const episodeImage = activeEpisode?.querySelector('img')?.getAttribute('src') + const showPoster = document.querySelector('img.object-cover.rounded-lg')?.getAttribute('src') + presenceData.details = 'Watching TV Show' + presenceData.name = episodeTitle + presenceData.state = `S${season} • E${episode} — ${episodeTitle} (${runtime}m)` + presenceData.largeImageKey = episodeImage || showPoster + presenceData.smallImageKey = ActivityAssets.Logo + } + } + + if (pathname.includes('/search')) { + presenceData.details = `Searching for Content` + const query = document.querySelector('input')?.getAttribute('value') + if (query) { + presenceData.state = `Query: ${query}` + } + presenceData.smallImageKey = Assets.Search + } + + if (location.pathname === '/manga' && location.search.includes('q=')) { + presenceData.details = 'Searching for Manga' + + const query = document.querySelector('input')?.value + if (query) { + presenceData.state = `Query: ${query}` + } + + presenceData.smallImageKey = Assets.Search + } + else if (location.pathname === '/manga') { + presenceData.details = 'Browsing Manga' + presenceData.smallImageKey = Assets.Viewing + } + + if (location.pathname === '/games' && location.search.includes('q=')) { + presenceData.details = 'Searching for Game' + + const query = document.querySelector('input')?.value + if (query) { + presenceData.state = `Query: ${query}` + } + + presenceData.smallImageKey = Assets.Search + } + else if (location.pathname === '/games') { + presenceData.details = 'Browsing Games' + presenceData.smallImageKey = Assets.Viewing + } + + if (location.pathname === '/torrent' && location.search.includes('q=')) { + presenceData.details = 'Searching for Torrents' + + const query = document.querySelector('input')?.value + if (query) { + presenceData.state = `Query: ${query}` + } + + presenceData.smallImageKey = Assets.Search + } + else if (location.pathname === '/torrent') { + presenceData.details = 'Browsing Torrents' + presenceData.smallImageKey = Assets.Viewing + } + + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +}) diff --git a/websites/0-9/1Shows/metadata.json b/websites/0-9/1Shows/metadata.json index 5dd7443b0c0d..1aed1c4f1c13 100644 --- a/websites/0-9/1Shows/metadata.json +++ b/websites/0-9/1Shows/metadata.json @@ -11,7 +11,7 @@ }, "url": "www.1shows.nl", "regExp": "^https?[:][/][/](www[.])?1shows[.]nl[/]", - "version": "1.1.2", + "version": "1.1.3", "logo": "https://cdn.rcd.gg/PreMiD/websites/0-9/1Shows/assets/logo.png", "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/0-9/1Shows/assets/thumbnail.png", "color": "#121212", @@ -22,10 +22,6 @@ "tv" ], "settings": [ - { - "id": "lang", - "multiLanguage": true - }, { "id": "privacy", "title": "Privacy Mode", diff --git a/websites/0-9/1Shows/presence.ts b/websites/0-9/1Shows/presence.ts index 5d3e812b4e4a..7f9743fd96ca 100644 --- a/websites/0-9/1Shows/presence.ts +++ b/websites/0-9/1Shows/presence.ts @@ -29,31 +29,27 @@ presence.on('UpdateData', async () => { const pages: Record = { '/': { - details: 'Viewing HomePage 🏠', + details: 'Viewing HomePage', smallImageKey: Assets.Viewing, }, '/profile': { - details: 'Viewing Profile 👤', + details: 'Viewing Profile', smallImageKey: Assets.Viewing, }, '/tv': { - details: 'Browsing TV Shows 📺', - smallImageKey: Assets.Viewing, - }, - '/search': { - details: 'Browsing Search 🔎', + details: 'Browsing TV Shows', smallImageKey: Assets.Viewing, }, '/livetv': { - details: 'Browsing Live TV 📶', + details: 'Browsing Live TV', smallImageKey: Assets.Viewing, }, '/sports': { - details: 'Live Sports ⚽', + details: 'Browsing Live Sports', smallImageKey: Assets.Viewing, }, '/games': { - details: 'Browsing Games 🎮', + details: 'Playing Games', smallImageKey: Assets.Viewing, }, } @@ -176,7 +172,7 @@ presence.on('UpdateData', async () => { } if (pathname.includes('/search')) { - presenceData.details = `Searching for Movies/TvShows 🔎` + presenceData.details = `Searching for Content` const query = document.querySelector('input')?.getAttribute('value') if (query) { presenceData.state = `Query: ${query}` diff --git a/websites/E/Enma/metadata.json b/websites/E/Enma/metadata.json index 57b268433b61..0c0b30cdc353 100644 --- a/websites/E/Enma/metadata.json +++ b/websites/E/Enma/metadata.json @@ -11,7 +11,7 @@ }, "url": "enma.lol", "regExp": "^https?[:][/][/]([a-z0-9-]+[.])*enma[.]lol[/]", - "version": "1.0.1", + "version": "1.0.2", "logo": "https://cdn.rcd.gg/PreMiD/websites/E/Enma/assets/logo.png", "thumbnail": "https://cdn.rcd.gg/PreMiD/websites/E/Enma/assets/thumbnail.png", "color": "#121212", diff --git a/websites/E/Enma/presence.ts b/websites/E/Enma/presence.ts index d94a3a1525f6..6624b0c48530 100644 --- a/websites/E/Enma/presence.ts +++ b/websites/E/Enma/presence.ts @@ -23,51 +23,55 @@ presence.on('UpdateData', async () => { case pathname === '/search': presenceData.details = `Searching...` presenceData.state = `Query : ${decodeURIComponent(new URLSearchParams(search).get('keyword') || '').replace(/\b\w/g, c => c.toUpperCase())}` + presenceData.smallImageKey = Assets.Search break case pathname.includes('/genre/'): presenceData.details = `Browsing Genre` presenceData.state = `${pathname.split('/')[2]}` break case pathname.includes('/watch/'): { - presenceData.details = document.querySelector('p.text-\\[26px\\]')?.textContent?.trim() - const coverArt = document.querySelector('div.flex.flex-col.gap-y-4.items-start.ml-8')?.querySelector('img')?.src + const slug = pathname.split('/watch/')[1]?.split('?')[0] + const title = slug + ?.replace(/-\d+$/, '') + ?.replace(/-/g, ' ') + ?.replace(/\b\w/g, c => c.toUpperCase()) + presenceData.details = title || 'Watching Anime' const episodeNumber = document.querySelector('div.bg-\\[\\#1E90FF\\]')?.querySelector('span')?.textContent presenceData.state = `Episode ${episodeNumber}` - presenceData.largeImageKey = coverArt ?? ActivityAssets.Logo - presenceData.smallImageKey = ActivityAssets.Logo + presenceData.largeImageKey = ActivityAssets.Logo break } case pathname.includes('/az-list'): presenceData.details = `Viewing AZ List: ${pathname.split('/')[2]}` - presenceData.smallImageKey = Assets.Search + presenceData.smallImageKey = Assets.Viewing break case pathname === '/movie': presenceData.details = 'Browsing movies...' - presenceData.smallImageKey = Assets.Search + presenceData.smallImageKey = Assets.Viewing break case pathname === '/tv': presenceData.details = 'Browsing TV series...' - presenceData.smallImageKey = Assets.Search + presenceData.smallImageKey = Assets.Viewing break case pathname === '/ova': presenceData.details = 'Browsing OVAs...' - presenceData.smallImageKey = Assets.Search + presenceData.smallImageKey = Assets.Viewing break case pathname === '/ona': presenceData.details = 'Browsing ONAs...' - presenceData.smallImageKey = Assets.Search + presenceData.smallImageKey = Assets.Viewing break case pathname === '/special': presenceData.details = 'Browsing specials...' - presenceData.smallImageKey = Assets.Search + presenceData.smallImageKey = Assets.Viewing break case pathname === '/recently-updated': presenceData.details = 'Browsing recently updated anime...' - presenceData.smallImageKey = Assets.Search + presenceData.smallImageKey = Assets.Viewing break case pathname === '/recently-added': presenceData.details = 'Browsing recently added anime...' - presenceData.smallImageKey = Assets.Search + presenceData.smallImageKey = Assets.Viewing break default: presenceData.details = 'Browsing Enma...' diff --git a/websites/F/FlickyStream/metadata.json b/websites/F/FlickyStream/metadata.json new file mode 100644 index 000000000000..2514e076bf7c --- /dev/null +++ b/websites/F/FlickyStream/metadata.json @@ -0,0 +1,32 @@ +{ + "$schema": "https://schemas.premid.app/metadata/1.16", + "apiVersion": 1, + "author": { + "id": "1428056065840255027", + "name": "ahmanitsucks" + }, + "service": "FlickyStream", + "description": { + "en": "A streaming platform for movies, TV shows, and anime." + }, + "url": "flickystream.ru", + "regExp": "^https?[:][/][/](www[.])?flickystream[.]ru[/]", + "version": "1.0.0", + "logo": "https://i.imgur.com/M4LL1F8.png", + "thumbnail": "https://i.imgur.com/87Bezq3.png", + "color": "#E53935", + "category": "videos", + "tags": [ + "movies", + "anime", + "tv" + ], + "settings": [ + { + "id": "privacy", + "title": "Privacy Mode", + "icon": "fas fa-user-secret", + "value": false + } + ] +} diff --git a/websites/F/FlickyStream/presence.ts b/websites/F/FlickyStream/presence.ts new file mode 100644 index 000000000000..038ae844012b --- /dev/null +++ b/websites/F/FlickyStream/presence.ts @@ -0,0 +1,137 @@ +import { ActivityType, Assets } from 'premid' + +const presence = new Presence({ + clientId: '1453062828033577203', +}) + +const browsingTimestamp = Math.floor(Date.now() / 1000) + +enum ActivityAssets { + Logo = 'https://i.imgur.com/M4LL1F8.png', +} + +presence.on('UpdateData', async () => { + let presenceData: PresenceData = { + largeImageKey: ActivityAssets.Logo, + startTimestamp: browsingTimestamp, + details: 'Unsupported Page', + } + + const { pathname, search } = document.location + + const privacy = await presence.getSetting('privacy') + + if (privacy) { + presenceData.details = 'Watching FlickyStream' + presence.setActivity(presenceData) + return + } + + const pages: Record = { + '/': { + details: 'Viewing HomePage', + smallImageKey: Assets.Viewing, + }, + '/tv': { + details: 'Browsing TV Shows', + smallImageKey: Assets.Viewing, + }, + '/movie': { + details: 'Browsing Movies', + smallImageKey: Assets.Viewing, + }, + '/sports': { + details: 'Watching Live Sports', + smallImageKey: Assets.Viewing, + }, + '/watch-history': { + details: 'Browsing Watch History', + smallImageKey: Assets.Viewing, + }, + '/trending': { + details: 'Browsing Trending Content', + smallImageKey: Assets.Viewing, + }, + '/profile': { + details: 'Browsing Profile', + smallImageKey: Assets.Viewing, + }, + '/login': { + details: 'Signing In', + smallImageKey: Assets.Viewing, + }, + '/signup': { + details: 'Signing Up', + smallImageKey: Assets.Viewing, + }, + } + + for (const [path, data] of Object.entries(pages)) { + if (pathname === path) { + presenceData = { + ...presenceData, + ...data, + type: ActivityType.Watching, + } + } + } + + if (pathname.startsWith('/movie/') || pathname.startsWith('/tv/')) { + const title = document.querySelector('img[alt][src*="tmdb.org"]')?.getAttribute('alt') || document.title.replace(' | FlickyStream', '') || 'Viewing Movie' + const image = document.querySelector('div.hidden.md\\:block img')?.getAttribute('src') || document.querySelector('img[src*="tmdb.org"]')?.getAttribute('src') + const rating = (() => { + const el = document.querySelector('div.text-amber-400') + return el?.childNodes[el.childNodes.length - 1]?.textContent?.trim() + })() + presenceData.details = 'FlickyStream' + presenceData.state = [ + title, + rating && `⭐ ${rating}`, + ] + .filter(Boolean) + .join(' • ') + if (image) { + presenceData.type = ActivityType.Watching + presenceData.name = title + presenceData.largeImageKey = image + presenceData.largeImageText = title + presenceData.smallImageKey = ActivityAssets.Logo + } + } + + if (pathname.startsWith('/player/movie/')) { + const title = document.querySelector('h1.text-xl.md\\:text-2xl.font-semibold')?.textContent?.trim() || document.title.replace(' | FlickyStream', '') || 'Viewing Movie' + presenceData.details = 'FlickyStream' + if (title) { + presenceData.type = ActivityType.Watching + presenceData.name = title + presenceData.largeImageKey = ActivityAssets.Logo + presenceData.largeImageText = title + } + } + + if (pathname.startsWith('/player/tv/')) { + const title = document.querySelector('h1.text-xl.md\\:text-2xl.font-semibold')?.textContent?.trim() || document.title.replace(' | FlickyStream', '') || 'Viewing Movie' + const rawTitle = document.querySelector('h1.text-xl.md\\:text-2xl.font-semibold')?.textContent?.trim() || '' + const [showPart, episodePart] = rawTitle.split(' - ') + const showTitle = showPart || 'Unknown Show' + const [, seasonNo, episodeNo] = episodePart?.match(/Season\s+(\d+)\s+Episode\s+(\d+)/) || [] + presenceData.details = 'FlickyStream' + if (title) { + presenceData.type = ActivityType.Watching + presenceData.name = `${showTitle} S${seasonNo}E${episodeNo}` + presenceData.largeImageKey = ActivityAssets.Logo + presenceData.largeImageText = showTitle + } + } + if (pathname.includes('/search')) { + presenceData.type = ActivityType.Watching + presenceData.details = `Searching...` + presenceData.state = `Query: ${decodeURIComponent(new URLSearchParams(search).get('q') || '').replace(/\b\w/g, c => c.toUpperCase())}` + presenceData.smallImageKey = Assets.Search + } + + if (presenceData.details) + presence.setActivity(presenceData) + else presence.setActivity() +})