Skip to content

Commit 48af745

Browse files
committed
一部のページでクローラーがエラーになるバグを修正
1 parent a23862a commit 48af745

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/lib/src/crawler/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@ export interface ArticleResponse {
1414
export const fetchArticle = async (
1515
url: string,
1616
): Promise<ArticleResponse | null> => {
17-
const { host } = new URL(url);
18-
19-
if (host === 'note.com') {
17+
if (/https?:\/\/note.com\/[^/]+\/n\/[^/]+/.exec(url)) {
2018
return fetchArticleFromNote(url);
2119
}
2220

23-
if (host === 'qiita.com') {
21+
if (/https?:\/\/qiita.com\/[^/]+\/items\/[^/]+/.exec(url)) {
2422
return fetchArticleFromQiita(url);
2523
}
2624

27-
if (host === 'zenn.dev') {
25+
if (/https?:\/\/zenn.dev\/[^/]+\/articles\/[^/]+/.exec(url)) {
2826
return fetchArticleFromZenn(url);
2927
}
3028

0 commit comments

Comments
 (0)