ci: fix pipeline, update readme and anonymize ZT references
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Appels réseau pour zt.news.
|
||||
* Pas de challenge CF actif, fetch direct simple.
|
||||
*/
|
||||
|
||||
const TIMEOUT = 20_000;
|
||||
const UA = 'Mozilla/5.0 (X11; Linux x86_64; rv:135.0) Gecko/20100101 Firefox/135.0';
|
||||
|
||||
async function ztnGet(url: string): Promise<string> {
|
||||
const res = await fetch(url, {
|
||||
headers: {
|
||||
'User-Agent': UA,
|
||||
'Accept': 'text/html,application/xhtml+xml,*/*;q=0.8',
|
||||
'Accept-Language': 'fr-FR,fr;q=0.9,en;q=0.8',
|
||||
},
|
||||
redirect: 'follow',
|
||||
signal: AbortSignal.timeout(TIMEOUT),
|
||||
});
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
return res.text();
|
||||
}
|
||||
|
||||
export async function fetchSearch(baseUrl: string, query: string): Promise<string> {
|
||||
return ztnGet(`${baseUrl}/?p=films&search=${encodeURIComponent(query)}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* News n'a pas vraiment de page "nouveautés" séparée — la home expose déjà
|
||||
* une grille de blocs cover_global avec les derniers films/séries.
|
||||
*/
|
||||
export async function fetchTrending(baseUrl: string, type: 'films' | 'series'): Promise<string> {
|
||||
return ztnGet(`${baseUrl}/?p=${type}`);
|
||||
}
|
||||
|
||||
export async function fetchPage(pageUrl: string): Promise<string> {
|
||||
return ztnGet(pageUrl);
|
||||
}
|
||||
Reference in New Issue
Block a user