-
Notifications
You must be signed in to change notification settings - Fork 141
feat: add Popr provider with streaming and subtitles support #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0d316c0
c53e33c
2602d06
21b6850
068675c
837aaa3
c3d4d07
722d957
8d0c6c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,223 @@ | ||||||||||||
| import { BaseProvider } from '@omss/framework'; | ||||||||||||
| import type { | ||||||||||||
| ProviderCapabilities, | ||||||||||||
| ProviderMediaObject, | ||||||||||||
| ProviderResult, | ||||||||||||
| Source, | ||||||||||||
| SourceType, | ||||||||||||
| Subtitle | ||||||||||||
| } from '@omss/framework'; | ||||||||||||
| import axios from 'axios'; | ||||||||||||
| import { VidnestResponse } from './popr.types.js'; | ||||||||||||
| export class PoprProvider extends BaseProvider { | ||||||||||||
| readonly id = 'popr'; | ||||||||||||
| readonly name = 'Popr'; | ||||||||||||
| readonly enabled = true; | ||||||||||||
| readonly BASE_URL = 'https://popr.ink'; | ||||||||||||
| readonly HEADERS = { | ||||||||||||
| 'User-Agent': | ||||||||||||
| 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150 Safari/537.36', | ||||||||||||
| Referer: `${this.BASE_URL}/` | ||||||||||||
| }; | ||||||||||||
|
|
||||||||||||
| readonly capabilities: ProviderCapabilities = { | ||||||||||||
| supportedContentTypes: ['movies', 'tv'] | ||||||||||||
| }; | ||||||||||||
|
|
||||||||||||
| /** | ||||||||||||
| * Fetch movie sources | ||||||||||||
| */ | ||||||||||||
| async getMovieSources(media: ProviderMediaObject): Promise<ProviderResult> { | ||||||||||||
| try { | ||||||||||||
| this.console.log('fetching movie response', media); | ||||||||||||
| let movieSource = await this.fetchSource(media, 'movie'); | ||||||||||||
|
|
||||||||||||
| return { | ||||||||||||
| sources: movieSource.sources, | ||||||||||||
| subtitles: movieSource.subtitles, | ||||||||||||
| diagnostics: [] | ||||||||||||
| }; | ||||||||||||
| } catch (error) { | ||||||||||||
| this.console.error( | ||||||||||||
| error instanceof Error | ||||||||||||
| ? error.message | ||||||||||||
| : 'error at getting movie source' | ||||||||||||
| ); | ||||||||||||
| return this.emptyResult( | ||||||||||||
| error instanceof Error | ||||||||||||
| ? error.message | ||||||||||||
| : 'error at getting source', | ||||||||||||
| media | ||||||||||||
| ); | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| /** | ||||||||||||
| * Fetch TV episode sources | ||||||||||||
| */ | ||||||||||||
| async getTVSources(media: ProviderMediaObject): Promise<ProviderResult> { | ||||||||||||
| try { | ||||||||||||
| this.console.log('fetching tv response', media); | ||||||||||||
| let tvSource = await this.fetchSource(media, 'tv'); | ||||||||||||
|
|
||||||||||||
| return { | ||||||||||||
| sources: tvSource.sources, | ||||||||||||
| subtitles: tvSource.subtitles, | ||||||||||||
| diagnostics: [] | ||||||||||||
| }; | ||||||||||||
|
Comment on lines
+63
to
+67
|
||||||||||||
| } catch (error) { | ||||||||||||
| this.console.error( | ||||||||||||
| error instanceof Error | ||||||||||||
| ? error.message | ||||||||||||
| : 'error at getting movie source' | ||||||||||||
|
||||||||||||
| : 'error at getting movie source' | |
| : 'error at getting tv source' |
Copilot
AI
Apr 26, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subtitles are returned with the raw sub.url instead of being proxied. Other providers typically proxy subtitle URLs to avoid CORS issues and to attach any required headers/referer. Consider using createProxyUrl here (and include headers if Popr requires them).
| url: sub.url, | |
| url: this.createProxyUrl(sub.url, { | |
| ...this.HEADERS, | |
| Referer: `${this.BASE_URL}/` | |
| }), |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| export type VidnestResponse = { | ||
| success: boolean; | ||
| results: { | ||
| server: string; | ||
| serverName: string; | ||
| streams: { | ||
| url: string; | ||
| quality: string; | ||
| isM3U8: boolean; | ||
| headers?: { | ||
| Referer?: string; | ||
| Origin?: string; | ||
| }; | ||
| }[]; | ||
| subtitles?: { | ||
| url: string; | ||
| format: string; | ||
| lang: string; | ||
| }[]; | ||
| }[]; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
getMovieSources, iffetchSourcereturns no sources/subtitles (it returns empty arrays when all servers fail), this currently returnsdiagnostics: [], which makes failures silent. Consider returningemptyResult('No playable sources found', media)(or adding a warning diagnostic) whenmovieSource.sources.length === 0so consumers can distinguish 'no sources' from 'provider succeeded'.