Skip to content

Commit

Permalink
fix: unresolved cookpad backlink
Browse files Browse the repository at this point in the history
  • Loading branch information
gensart-x committed Apr 28, 2024
1 parent 910f962 commit 56bcebd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/services/external/cookpad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const getRecipeList = (rawRecipeDom: string): Recipes => {
$('[data-search-tracking-id-name-value="recipe_id"]')
.children('li[itemprop="itemListElement"]').toArray().map(recipeDom => ({
name: $(recipeDom).find('a.block-link__main').text().trim().replaceAll('\n', ''),
backlink: COOKPAD_URL.replaceAll('id/cari/', '') + $(recipeDom).find('a.block-link__main').attr('href'),
backlink: COOKPAD_URL.replaceAll('/id/cari/', '') + $(recipeDom).find('a.block-link__main').attr('href'),
author: $(recipeDom).find('span.text-cookpad-gray-600.text-cookpad-12').text().trim().replaceAll('\n', ''),
duration: $(recipeDom).find('ul.clamp-1.text-cookpad-12').children('li').first().find('span.mise-icon-text').text().trim().replaceAll('\n', '') ?? '-'
}));
Expand Down Expand Up @@ -104,6 +104,10 @@ const cookpadRecipe: Executor = async (client, message) => {
return 0;
}

(async () => {
console.log(await getCookpadRecipe('rendang'));
})()

export {
cookpadRecipe
}

0 comments on commit 56bcebd

Please sign in to comment.