Skip to content

Commit 8060a2e

Browse files
committed
fix(wtr-lab): add headers when fetching chapters
Signed-off-by: K1ngfish3r <26593485+K1ngfish3r@users.noreply.github.com>
1 parent b6e4b90 commit 8060a2e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

plugins/english/wtrlab.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ class WTRLAB implements Plugin.PluginBase {
88
id = 'WTRLAB';
99
name = 'WTR-LAB';
1010
site = 'https://wtr-lab.com/';
11-
version = '1.1.2';
11+
version = '1.1.3';
1212
icon = 'src/en/wtrlab/icon.png';
1313
sourceLang = 'en/';
14+
baggage = '';
1415

1516
async popularNovels(
1617
page: number,
@@ -137,6 +138,7 @@ class WTRLAB implements Plugin.PluginBase {
137138
const body = await fetchApi(this.site + novelPath).then(res => res.text());
138139
const loadedCheerio = parseHTML(body);
139140

141+
this.baggage = loadedCheerio('meta[name="baggage"]').attr('content')!;
140142
const nextDataElement = loadedCheerio('#__NEXT_DATA__');
141143
const nextDataText = nextDataElement.html();
142144

@@ -591,8 +593,14 @@ class WTRLAB implements Plugin.PluginBase {
591593
const end = Math.min(start + batchSize - 1, totalChapters);
592594

593595
try {
596+
const headers: Record<string, string> = {};
597+
if (this.baggage) {
598+
headers.baggage = this.baggage;
599+
}
600+
594601
const response = await fetchApi(
595602
`${this.site}api/chapters/${rawId}?start=${start}&end=${end}`,
603+
{ headers },
596604
);
597605

598606
const data = await response.json();

0 commit comments

Comments
 (0)