Skip to content

Commit

Permalink
fix: provider search options
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Jan 25, 2024
1 parent ceecc08 commit 2580488
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/get-bonus/src/animate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class Animate extends Provider {
super('animate', '');
}

async search(text: string, options: SearchOptions): Promise<SearchResult[]> {
async search(text: string, options: Partial<SearchOptions>): Promise<SearchResult[]> {
return [];
}

Expand Down
11 changes: 5 additions & 6 deletions packages/get-bonus/src/comiczin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class Comiczin extends Provider {
super('comiczin', 'https://shop.comiczin.jp');
}

async search(text: string, options: SearchOptions): Promise<SearchResult[]> {
async search(text: string, options: Partial<SearchOptions>): Promise<SearchResult[]> {
const html = await ofetch(this.baseUrl + '/products/list.php', {
query: {
mode: 'search',
Expand Down Expand Up @@ -40,11 +40,10 @@ export class Comiczin extends Provider {
const title = doc.querySelector('.fw_main_block_header_type2');
const imgs = doc.querySelectorAll('img[id^=sample_img]:not(img[src$="s.jpg"])');
const descs = doc.querySelector('.div_block_main_item_comment')?.textContent;
const items = [...imgs]
.map((img, i) => ({
image: this.baseUrl + (img as HTMLImageElement).src,
description: descs?.substring(descs.lastIndexOf('【ZIN特典】')).split('\n')[0] || ''
}));
const items = [...imgs].map((img, i) => ({
image: this.baseUrl + (img as HTMLImageElement).src,
description: descs?.substring(descs.lastIndexOf('【ZIN特典】')).split('\n')[0] || ''
}));
return {
provider: this.id,
title: title?.textContent?.trim() || '',
Expand Down
2 changes: 1 addition & 1 deletion packages/get-bonus/src/gamers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class Gamers extends Provider {
super('gamers', 'https://www.gamers.co.jp');
}

async search(text: string, options: SearchOptions): Promise<SearchResult[]> {
async search(text: string, options: Partial<SearchOptions>): Promise<SearchResult[]> {
const html = await ofetch(this.baseUrl + '/products/list.php', {
query: {
smt: text,
Expand Down
2 changes: 1 addition & 1 deletion packages/get-bonus/src/mangaoh/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class Mangaoh extends Provider {
super('mangaoh', 'https://www.mangaoh.co.jp');
}

async search(text: string, options: SearchOptions): Promise<SearchResult[]> {
async search(text: string, options: Partial<SearchOptions>): Promise<SearchResult[]> {
const html = await ofetch(this.baseUrl + '/search', {
query: {
q: text + ' +特典'
Expand Down
2 changes: 1 addition & 1 deletion packages/get-bonus/src/melonbooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class Melonbooks extends Provider {
super('melonbooks', 'https://www.melonbooks.co.jp');
}

async search(text: string, options: SearchOptions): Promise<SearchResult[]> {
async search(text: string, options: Partial<SearchOptions>): Promise<SearchResult[]> {
const html = await ofetch(this.baseUrl + '/search/search.php', {
query: {
mode: 'search',
Expand Down
2 changes: 1 addition & 1 deletion packages/get-bonus/src/toranoana/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class Toranoana extends Provider {
super('toranoana', 'https://ecs.toranoana.jp');
}

async search(text: string, options: SearchOptions): Promise<SearchResult[]> {
async search(text: string, options: Partial<SearchOptions>): Promise<SearchResult[]> {
const html = await ofetch(this.baseUrl + '/tora/ec/app/catalog/list', {
query: {
searchWord: text,
Expand Down

0 comments on commit 2580488

Please sign in to comment.