diff --git a/README.md b/README.md index e90fb2f..44fe13b 100755 --- a/README.md +++ b/README.md @@ -913,6 +913,11 @@ const options = { currency: 'EUR', host: 'www.amazon.es', }, + EG: { + country: 'Egypt', + currency: 'EGP', + host: 'www.amazon.eg', + }, TR: { country: 'Turkey', currency: 'TRY', diff --git a/lib/constant.js b/lib/constant.js index 427d251..a2a480c 100755 --- a/lib/constant.js +++ b/lib/constant.js @@ -772,6 +772,62 @@ module.exports = { }, }, }, + EG: { + country: 'Egypt', + currency: 'EGP', + host: 'www.amazon.eg', + symbol: 'ج.م', + variants: { + split_text: 'Click to select ', + }, + best_seller: (text) => { + if (text) { + const match = text.match(/(#[\d,|]+) in[\s\n ]([\w&'\s]+)/); + if (match) { + return { rank: parseInt(match[1].replace(/[^\d]/g, '')), category: match[2].trim() }; + } + } + return ''; + }, + review_date: (date) => { + const dateRegex = /on (.+)$/.exec(date); + if (dateRegex) { + return { + date: dateRegex[1], + unix: moment(new Date(`${dateRegex[1]} 02:00:00`)) + .utc() + .unix(), + }; + } + return ''; + }, + price_format: (price) => { + const formatedPrice = price.replace(/[^\d+\.]/g, ''); + return parseFloat(formatedPrice); + }, + product_information: { + id: [ + '#detailBullets_feature_div > ul', + '#productDetails_detailBullets_sections1', + '#productDetails_techSpec_section_1', + '#productDetails_techSpec_section_2', + '#detailBulletsWrapper_feature_div > ul:nth-child(5)', + ], + fields: { + 'Amazon Best Sellers Rank': { key: '', rank: true }, + 'Best-sellers rank': { key: '', rank: true }, + 'Best Sellers Rank': { key: '', rank: true }, + 'Package Dimensions': { key: 'dimensions' }, + 'Product Dimensions': { key: 'dimensions' }, + 'Parcel Dimensions': { key: 'dimensions' }, + 'Item Weight': { key: 'weight' }, + Manufacturer: { key: 'manufacturer' }, + 'Release date': { key: 'available_from' }, + 'Date First Available': { key: 'available_from' }, + 'Item model number': { key: 'model_number' }, + }, + }, + }, TR: { country: 'Turkey', currency: 'TRY',