File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import cache from '@/utils/cache';
55import { load } from 'cheerio' ;
66
77const apiKey = '0QfOX3Vn51YCzitbLaRkTTBadtWpgTN8NZLW0C1SEM' ;
8+ const fetchedArticleContentHtmlImgRegex = / < i m g d a t a - r e f e r e n c e = " i m a g e " d a t a - d o c u m e n t - i d = " c m s \/ a p i \/ a m p \/ i m a g e \/ ( [ A - Z a - z 0 - 9 ] + ) " > / ;
89
910export const route : Route = {
1011 path : '/:market/:name/:id' ,
@@ -57,8 +58,8 @@ export const route: Route = {
5758 const fetchedArticleContentHtml = ( await cache . tryGet ( articleId , async ( ) => {
5859 const articleData = await ofetch ( `https://assets.msn.com/content/view/v2/Detail/${ market } /${ articleId } ` ) ;
5960 return articleData . body ;
60- } ) ) as string ; // cache article content for 3 months
61- articleContentHtml = fetchedArticleContentHtml ;
61+ } ) ) as string ;
62+ articleContentHtml = fetchedArticleContentHtml . replace ( fetchedArticleContentHtmlImgRegex , '<img src="https://img-s-msn-com.akamaized.net/tenant/amp/entityid/$1.img">' ) ;
6263 }
6364
6465 return {
You can’t perform that action at this time.
0 commit comments