-
-
Save lamb-mei/e57cc0a4764c3a8cdaf533aef318f4f0 to your computer and use it in GitHub Desktop.
擷取 costco 商品資料,如果商品沒有貨, result 的結果會是已售完
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
var cheerio = require('cheerio'); | |
var url = 'https://www.costco.com.tw/Baby-Care-Kids-Toys/Toys/Infant-%26-Preschool/VTech-Sit-To-Stand-Ultimate-Alphabet-Train/p/105123'; | |
request(url, function(err, res, body){ | |
var $ = cheerio.load(body); | |
var result = $('.stock-status').text().trim(); | |
console.log(result); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment