Skip to content

Commit

Permalink
fix: get melon and toranonaa
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Jan 24, 2024
1 parent 81dc33a commit 1f07f5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions packages/get-bonus/src/melonbooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export class Melonbooks extends Provider {
const html: string = await ofetch(this.baseUrl + '/search/search.php', {
query: {
name: text,
'additional[]': 'pr'
'additional[]': 'pr',
'category_ids[]': '4', // コミック
'child_category_ids[]': ['12', '43'] // コミック 和 ノベル
}
});

Expand All @@ -26,7 +28,7 @@ export class Melonbooks extends Provider {
const a = item.querySelector('.item-image > a') as HTMLAnchorElement;
return {
provider: this.id,
title: a.title,
title: a.title.trim(),
url: this.baseUrl + a.href
};
});
Expand All @@ -37,7 +39,7 @@ export class Melonbooks extends Provider {
const dom = new JSDOM(html);
const doc = dom.window.document;

const title = doc.querySelector('.page-header')?.textContent || '';
const title = doc.querySelector('.page-header')?.textContent?.trim() || '';
const privItems = doc.querySelectorAll('.priv-item');
const items = [...privItems].map((item) => {
const img = item.querySelector('.priv_img') as HTMLImageElement;
Expand Down
4 changes: 2 additions & 2 deletions packages/get-bonus/src/toranoana/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export class Toranoana extends Provider {
const html: string = await ofetch(this.baseUrl + '/tora/ec/app/catalog/list', {
query: {
searchWord: text,
stock_status: '○,△',
commodity_kind_name: '特典'
stock_status: '○,△'
// commodity_kind_name: '特典'
}
});

Expand Down

0 comments on commit 1f07f5a

Please sign in to comment.