fix(wtr-lab): add headers when fetching chapters (#2222)
Signed-off-by: K1ngfish3r <26593485+K1ngfish3r@users.noreply.github.com>
This commit is contained in:
@@ -8,9 +8,10 @@ class WTRLAB implements Plugin.PluginBase {
|
|||||||
id = 'WTRLAB';
|
id = 'WTRLAB';
|
||||||
name = 'WTR-LAB';
|
name = 'WTR-LAB';
|
||||||
site = 'https://wtr-lab.com/';
|
site = 'https://wtr-lab.com/';
|
||||||
version = '1.1.2';
|
version = '1.1.3';
|
||||||
icon = 'src/en/wtrlab/icon.png';
|
icon = 'src/en/wtrlab/icon.png';
|
||||||
sourceLang = 'en/';
|
sourceLang = 'en/';
|
||||||
|
baggage = '';
|
||||||
|
|
||||||
async popularNovels(
|
async popularNovels(
|
||||||
page: number,
|
page: number,
|
||||||
@@ -137,6 +138,7 @@ class WTRLAB implements Plugin.PluginBase {
|
|||||||
const body = await fetchApi(this.site + novelPath).then(res => res.text());
|
const body = await fetchApi(this.site + novelPath).then(res => res.text());
|
||||||
const loadedCheerio = parseHTML(body);
|
const loadedCheerio = parseHTML(body);
|
||||||
|
|
||||||
|
this.baggage = loadedCheerio('meta[name="baggage"]').attr('content')!;
|
||||||
const nextDataElement = loadedCheerio('#__NEXT_DATA__');
|
const nextDataElement = loadedCheerio('#__NEXT_DATA__');
|
||||||
const nextDataText = nextDataElement.html();
|
const nextDataText = nextDataElement.html();
|
||||||
|
|
||||||
@@ -591,8 +593,14 @@ class WTRLAB implements Plugin.PluginBase {
|
|||||||
const end = Math.min(start + batchSize - 1, totalChapters);
|
const end = Math.min(start + batchSize - 1, totalChapters);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const headers: Record<string, string> = {};
|
||||||
|
if (this.baggage) {
|
||||||
|
headers.baggage = this.baggage;
|
||||||
|
}
|
||||||
|
|
||||||
const response = await fetchApi(
|
const response = await fetchApi(
|
||||||
`${this.site}api/chapters/${rawId}?start=${start}&end=${end}`,
|
`${this.site}api/chapters/${rawId}?start=${start}&end=${end}`,
|
||||||
|
{ headers },
|
||||||
);
|
);
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|||||||
Reference in New Issue
Block a user