diff --git a/package.json b/package.json index 1c3cb390..168d6cd4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "paperlib", - "version": "1.9.4-dev.1", + "version": "1.9.4-dev.2", "description": "A simple academic paper management tool for CSer.", "productName": "Paperlib", "author": "Geoffrey Chen ", diff --git a/packages/preload/repositories/scraper-repository/scrapers/paperwithcode.ts b/packages/preload/repositories/scraper-repository/scrapers/paperwithcode.ts index acae89df..76a3cf52 100644 --- a/packages/preload/repositories/scraper-repository/scrapers/paperwithcode.ts +++ b/packages/preload/repositories/scraper-repository/scrapers/paperwithcode.ts @@ -42,11 +42,16 @@ export class PwCScraper extends Scraper { results: { url: string; is_official: boolean; + stars: number; }[]; }; + if (response.count) { let codeList: string[] = []; - for (const result of response.results) { + + const sortedResults = response.results.sort((a, b) => b.stars - a.stars); + + for (const result of sortedResults.slice(0, 3)) { codeList.push( JSON.stringify({ url: result.url,