Skip to content

Commit

Permalink
Merge pull request #236 from hyeeyoung/dev
Browse files Browse the repository at this point in the history
release 1.2.1
  • Loading branch information
hyejungg authored Dec 11, 2022
2 parents 2f91349 + a963e81 commit 10c03d3
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,25 @@ const parsingForWconcept = async (url) => {
if (html.status == 200) {
const $ = cheerio.load(html.data);
$('meta').each((_, el) => {
const egTag = $(el).attr('property')?.split(/^eg:/)[1];
if (egTag) {
const egValue = $(el).attr('content');
switch (egTag) {
case 'itemName':
itemName = egValue;
break;
case 'itemImage':
itemImg = 'https:';
itemImg += egValue;
const ogTag = $(el).attr('property')?.split(/^og:/)[1];
if (ogTag) {
const ogValue = $(el).attr('content');
switch (ogTag) {
case 'description':
itemName = ogValue;
break;
case 'originalPrice':
itemPrice = egValue;
case 'image':
itemImg = ogValue;
break;
}
}
});
if (!itemPrice) {
// TODO 개선 필요
itemPrice = $(
'#frmproduct > div.price_wrap > dl > dd.normal > em',
).text();
}
}
});
itemPrice = itemPrice ? getPriceWithoutString(itemPrice) : undefined;
Expand Down

0 comments on commit 10c03d3

Please sign in to comment.