-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from himanshu8443/feature
new provider and fix
- Loading branch information
Showing
10 changed files
with
242 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export const vadapavCatalogList = [ | ||
{ | ||
title: 'Movies', | ||
filter: '/608c853f-704e-48f0-b785-4ae1f48ea70d', | ||
}, | ||
{ | ||
title: 'Tv Shows', | ||
filter: '/72983eef-a12f-4be4-99a7-e8f6afa568c1', | ||
}, | ||
{ | ||
title: 'Anime', | ||
filter: '/36abf81c-1032-4fbf-9a55-347a05ce2ca3', | ||
}, | ||
]; | ||
|
||
export const vadapavGenresList = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {vadapavGetPosts} from './vadapavGetPosts'; | ||
import {vadapavCatalogList, vadapavGenresList} from './VagapavCatalog'; | ||
import {ProviderType} from '../../Manifest'; | ||
import {vadapavGetInfo} from './vadapavGetInfo'; | ||
import {vadapavGetStream} from './vadapavGetStream'; | ||
import {vadapavGetEpisodeLinks} from './vadapavGetEpisodes'; | ||
|
||
export const vadapavProvider: ProviderType = { | ||
catalog: vadapavCatalogList, | ||
genres: vadapavGenresList, | ||
getPosts: vadapavGetPosts, | ||
getEpisodeLinks: vadapavGetEpisodeLinks, | ||
getInfo: vadapavGetInfo, | ||
getStream: vadapavGetStream, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import axios from 'axios'; | ||
import * as cheerio from 'cheerio'; | ||
import {EpisodeLink} from '../types'; | ||
|
||
export const vadapavGetEpisodeLinks = async function ( | ||
url: string, | ||
): Promise<EpisodeLink[]> { | ||
try { | ||
const baseUrl = url?.split('/').slice(0, 3).join('/'); | ||
const res = await axios.get(url); | ||
const html = res.data; | ||
let $ = cheerio.load(html); | ||
const episodeLinks: EpisodeLink[] = []; | ||
|
||
$('.file-entry:not(:contains("Parent Directory"))').map((i, element) => { | ||
const link = $(element).attr('href'); | ||
if ( | ||
link && | ||
($(element).text()?.includes('.mp4') || | ||
$(element).text()?.includes('.mkv')) | ||
) { | ||
episodeLinks.push({ | ||
title: | ||
$(element).text()?.match(/E\d+/)?.[0]?.replace('E', 'Episode ') || | ||
i + 1 + '. ' + $(element).text(), | ||
link: baseUrl + link, | ||
}); | ||
} | ||
}); | ||
|
||
// console.log(episodeLinks); | ||
return episodeLinks; | ||
} catch (err) { | ||
console.error(err); | ||
return []; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import axios from 'axios'; | ||
import * as cheerio from 'cheerio'; | ||
import {EpisodeLink, Info, Link} from '../types'; | ||
|
||
export const vadapavGetInfo = async function (link: string): Promise<Info> { | ||
try { | ||
const baseUrl = link?.split('/').slice(0, 3).join('/'); | ||
const url = link; | ||
const res = await axios.get(url); | ||
const data = res.data; | ||
const $ = cheerio.load(data); | ||
const title = $('.directory') | ||
.children() | ||
.first() | ||
.text() | ||
.trim() | ||
?.split('/') | ||
.pop() | ||
?.trim(); | ||
console.log('title', title); | ||
const links: Link[] = []; | ||
|
||
$('.directory-entry:not(:contains("Parent Directory"))').map( | ||
(i, element) => { | ||
const link = $(element).attr('href'); | ||
if (link) { | ||
links.push({ | ||
episodesLink: baseUrl + link, | ||
title: $(element).text(), | ||
movieLinks: '', | ||
quality: '', | ||
}); | ||
} | ||
}, | ||
); | ||
const directLinks: EpisodeLink[] = []; | ||
$('.file-entry:not(:contains("Parent Directory"))').map((i, element) => { | ||
const link = $(element).attr('href'); | ||
if ( | ||
link && | ||
($(element).text()?.includes('.mp4') || | ||
$(element).text()?.includes('.mkv')) | ||
) { | ||
directLinks.push({ | ||
title: i + 1 + '. ' + $(element).text(), | ||
link: baseUrl + link, | ||
}); | ||
} | ||
}); | ||
|
||
if (directLinks.length > 0) { | ||
links.push({ | ||
episodesLink: '', | ||
title: title + ' DL', | ||
movieLinks: '', | ||
quality: '', | ||
directLinks: directLinks, | ||
}); | ||
} | ||
|
||
return { | ||
title: title, | ||
synopsis: '', | ||
image: '', | ||
imdbId: '', | ||
type: '', | ||
linkList: links, | ||
}; | ||
} catch (err) { | ||
console.error(err); | ||
return { | ||
title: '', | ||
synopsis: '', | ||
image: '', | ||
imdbId: '', | ||
type: '', | ||
linkList: [], | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import axios from 'axios'; | ||
import * as cheerio from 'cheerio'; | ||
import {Post} from '../types'; | ||
import {getBaseUrl} from '../getBaseUrl'; | ||
|
||
export const vadapavGetPosts = async function ( | ||
filter: string, | ||
page: number, | ||
providerValue: string, | ||
signal: AbortSignal, | ||
): Promise<Post[]> { | ||
try { | ||
const baseUrl = 'https://vadapav.mov'; | ||
if (page > 1) { | ||
return []; | ||
} | ||
const url = filter.includes('searchQuery=') | ||
? `${baseUrl}/s/${filter.replace('searchQuery=', '')}` | ||
: `${baseUrl + filter}`; | ||
console.log('vadapavGetPosts', url); | ||
const res = await axios.get(url, {signal}); | ||
const data = res.data; | ||
const $ = cheerio.load(data); | ||
const catalog: Post[] = []; | ||
$('.directory-entry:not(:contains("Parent Directory"))').map( | ||
(i, element) => { | ||
const title = $(element).text(); | ||
const link = $(element).attr('href'); | ||
const imageTitle = | ||
title?.length > 30 | ||
? title?.slice(0, 30)?.replaceAll('.', ' ') | ||
: title?.replaceAll('.', ' '); | ||
|
||
const image = `https://placehold.jp/23/000000/ffffff/200x400.png?text=${encodeURIComponent( | ||
imageTitle, | ||
)}&css=%7B%22background%22%3A%22%20-webkit-gradient(linear%2C%20left%20bottom%2C%20left%20top%2C%20from(%233f3b3b)%2C%20to(%23000000))%22%2C%22text-transform%22%3A%22%20capitalize%22%7D`; | ||
// console.log('title', image); | ||
if (title && link) { | ||
catalog.push({ | ||
title: title, | ||
link: baseUrl + link, | ||
image: image, | ||
}); | ||
} | ||
}, | ||
); | ||
// console.log(catalog); | ||
return catalog; | ||
} catch (err) { | ||
console.error('vadapav error ', err); | ||
return []; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import {Stream} from '../types'; | ||
|
||
export const vadapavGetStream = async ( | ||
url: string, | ||
type: string, | ||
): Promise<Stream[]> => { | ||
try { | ||
const stream: Stream[] = []; | ||
console.log('vadapavGetStream', type, url); | ||
stream.push({ | ||
server: 'vadapav', | ||
link: url, | ||
type: url?.split('.').pop() || 'mkv', | ||
}); | ||
|
||
return stream; | ||
} catch (err) { | ||
console.log('getStream error', err); | ||
return []; | ||
} | ||
}; |
Oops, something went wrong.