fix: ensure that VixSrc results have a title

This commit is contained in:
WebStreamr 2025-11-28 16:15:44 +00:00
parent 280abc4dea
commit 67d0508fd7
No known key found for this signature in database
5 changed files with 15 additions and 2 deletions

View file

@ -46,6 +46,7 @@ export class VixSrc extends Extractor {
sourceId: `${this.id}_${meta.countryCodes?.join('_')}`,
ttl: this.ttl,
meta: {
...meta,
countryCodes,
height: await guessHeightFromPlaylist(ctx, this.fetcher, playlistUrl, url, { headers }),
},

View file

@ -1,6 +1,6 @@
import { ContentType } from 'stremio-addon-sdk';
import { Context, CountryCode } from '../types';
import { Fetcher, getTmdbId, Id } from '../utils';
import { Fetcher, getTmdbId, getTmdbNameAndYear, Id } from '../utils';
import { Source, SourceResult } from './Source';
export class VixSrc extends Source {
@ -24,11 +24,19 @@ export class VixSrc extends Source {
public async handleInternal(ctx: Context, _type: string, id: Id): Promise<SourceResult[]> {
const tmdbId = await getTmdbId(ctx, this.fetcher, id);
const [name, year] = await getTmdbNameAndYear(ctx, this.fetcher, tmdbId);
let title: string = name;
if (tmdbId.season) {
title += ` ${tmdbId.season}x${tmdbId.episode}`;
} else {
title += ` (${year})`;
}
const url = tmdbId.season
? new URL(`/tv/${tmdbId.id}/${tmdbId.season}/${tmdbId.episode}`, this.baseUrl)
: new URL(`/movie/${tmdbId.id}`, this.baseUrl);
return [{ url, meta: { countryCodes: [CountryCode.multi] } }];
return [{ url, meta: { countryCodes: [CountryCode.multi], title } }];
};
}

View file

@ -0,0 +1 @@
{"adult":false,"backdrop_path":"/yYderAvjtKnYLBxKujVpmKTVlOM.jpg","belongs_to_collection":null,"budget":30000000,"genres":[{"id":18,"name":"Drama"},{"id":10752,"name":"War"}],"homepage":"https://www.warnerbros.com/movies/full-metal-jacket","id":600,"imdb_id":"tt0093058","origin_country":["US"],"original_language":"en","original_title":"Full Metal Jacket","overview":"A pragmatic U.S. Marine observes the dehumanizing effects the U.S.-Vietnam War has on his fellow recruits from their brutal boot camp training to the bloody street fighting in Hue.","popularity":5.8781,"poster_path":"/kMKyx1k8hWWscYFnPbnxxN4Eqo4.jpg","production_companies":[{"id":50819,"logo_path":null,"name":"Natant","origin_country":"US"},{"id":385,"logo_path":null,"name":"Stanley Kubrick Productions","origin_country":"GB"},{"id":174,"logo_path":"/ingPVoHnINIrFR7WHmYux1f5pES.png","name":"Warner Bros. Pictures","origin_country":"US"}],"production_countries":[{"iso_3166_1":"GB","name":"United Kingdom"},{"iso_3166_1":"US","name":"United States of America"}],"release_date":"1987-06-26","revenue":46357676,"runtime":117,"spoken_languages":[{"english_name":"English","iso_639_1":"en","name":"English"},{"english_name":"Vietnamese","iso_639_1":"vi","name":"Tiếng Việt"}],"status":"Released","tagline":"In Vietnam, the wind doesn't blow. It sucks.","title":"Full Metal Jacket","video":false,"vote_average":8.124,"vote_count":11084}

View file

@ -0,0 +1 @@
{"adult":false,"backdrop_path":"/dg3OindVAGZBjlT3xYKqIAdukPL.jpg","created_by":[{"id":211845,"credit_id":"52595fb5760ee346619587b5","name":"Charlie Brooker","original_name":"Charlie Brooker","gender":2,"profile_path":"/dmdLd5I4cnpCZzoITm26NOwu6Rn.jpg"}],"episode_run_time":[],"first_air_date":"2011-12-04","genres":[{"id":10765,"name":"Sci-Fi & Fantasy"},{"id":18,"name":"Drama"},{"id":9648,"name":"Mystery"}],"homepage":"https://www.netflix.com/title/70264888","id":42009,"in_production":true,"languages":["en"],"last_air_date":"2025-04-10","last_episode_to_air":{"id":6085099,"name":"USS Callister: Into Infinity","overview":"Nanette Cole and the crew of the USS Callister are stranded in an infinite virtual universe, fighting for survival against 30 million players.","vote_average":7.507,"vote_count":69,"air_date":"2025-04-10","episode_number":6,"episode_type":"finale","production_code":"","runtime":90,"season_number":7,"show_id":42009,"still_path":"/6JxoU4B1VMYf2tt8VPpNl8juKwm.jpg"},"name":"Black Mirror","next_episode_to_air":null,"networks":[{"id":26,"logo_path":"/7Ai64ZDaVbGDtm7f0QSZAKohjk4.png","name":"Channel 4","origin_country":"GB"},{"id":213,"logo_path":"/wwemzKWzjKYJFfCeiB57q3r4Bcm.png","name":"Netflix","origin_country":""}],"number_of_episodes":32,"number_of_seasons":7,"origin_country":["GB"],"original_language":"en","original_name":"Black Mirror","overview":"Twisted tales run wild in this mind-bending anthology series that reveals humanity's worst traits, greatest innovations and more.","popularity":41.8634,"poster_path":"/seN6rRfN0I6n8iDXjlSMk1QjNcq.jpg","production_companies":[{"id":76757,"logo_path":"/TUzHXCcbax9pQYWtIkLJNpRFnJ.png","name":"House of Tomorrow","origin_country":"GB"},{"id":18663,"logo_path":"/khiCshsZBdtUUYOr4VLoCtuqCEq.png","name":"Zeppotron","origin_country":"GB"},{"id":133905,"logo_path":"/tEEIQIYHQgPyOBgvoAlqPXfpEPX.png","name":"Broke & Bones","origin_country":"GB"}],"production_countries":[{"iso_3166_1":"GB","name":"United Kingdom"}],"seasons":[{"air_date":"2014-12-16","episode_count":1,"id":76596,"name":"Specials","overview":"","poster_path":"/zvfw0f35QmfHCPq5qvdHquFjrQC.jpg","season_number":0,"vote_average":0.0},{"air_date":"2011-12-04","episode_count":3,"id":51964,"name":"Season 1","overview":"Season one of this sci-fi anthology series imagines realities in which people are forced to power their own existence, receive memory implants and more.","poster_path":"/ztdy1f1cAjwsO0GpVKzNuqZ0PMv.jpg","season_number":1,"vote_average":7.7},{"air_date":"2013-02-11","episode_count":3,"id":51965,"name":"Season 2","overview":"This anthology series' second season examines the dark stories of a social media addict, a woman who's part of a live \"life\" show, and more.","poster_path":"/y71DeJiAv0dV8H8hiFnuIuyc0Gx.jpg","season_number":2,"vote_average":7.1},{"air_date":"2016-10-21","episode_count":6,"id":63871,"name":"Season 3","overview":"Lovers meet in a surreal paradise, a young man is tormented by strange texts, and a social app wields disturbing power in these high-tech tales.","poster_path":"/3mKYrlZpFbpFu7CaVxoleO68MFG.jpg","season_number":3,"vote_average":7.7},{"air_date":"2017-12-29","episode_count":6,"id":96276,"name":"Season 4","overview":"A fantasy spins out of control, all-seeing devices expose dark secrets, and a woman flees a ruthless hunter in more tales of technology run wild.","poster_path":"/zvLZvFU6RhdIPEH4afbUa4rmYtW.jpg","season_number":4,"vote_average":7.3},{"air_date":"2019-06-05","episode_count":3,"id":124320,"name":"Season 5","overview":"A video game transforms a longtime friendship, a social media company faces a hostage crisis, and a teen bonds with an AI version of her pop star idol.","poster_path":"/5xjf5aLeooPYWqH66vB80jMJT9u.jpg","season_number":5,"vote_average":6.5},{"air_date":"2023-06-15","episode_count":5,"id":331809,"name":"Season 6","overview":"Twisted tales that span eras — and terrors — deliver a myriad of surprises in this game-changing anthology series' most unpredictable season yet.","poster_path":"/kwATNh8JC1IJclnVwk8x7wZb2b4.jpg","season_number":6,"vote_average":6.3},{"air_date":"2025-04-10","episode_count":6,"id":383778,"name":"Season 7","overview":"The twisted stories are endless in this incredible anthology series that reveals humanity's worst traits, greatest inventions, and much more.","poster_path":"/aRN9LmPQHe8c1B2eR7MB3tiWFWk.jpg","season_number":7,"vote_average":7.1}],"spoken_languages":[{"english_name":"English","iso_639_1":"en","name":"English"}],"status":"Returning Series","tagline":"The future is bright.","type":"Scripted","vote_average":8.288,"vote_count":5809}

View file

@ -7,6 +7,7 @@ exports[`VixSrc handle imdb black mirror s4e2 1`] = `
"countryCodes": [
"multi",
],
"title": "Black Mirror 4x2",
},
"url": "https://vixsrc.to/tv/42009/4/2",
},
@ -20,6 +21,7 @@ exports[`VixSrc handle imdb full metal jacket 1`] = `
"countryCodes": [
"multi",
],
"title": "Full Metal Jacket (1987)",
},
"url": "https://vixsrc.to/movie/600",
},