无法使用Cheerio获取JS变量的值

时间:2017-07-06 08:26:44

标签: javascript jquery node.js cheerio

我有一个web page我加载了多个脚本。从这个页面我怎样才能使用Cheerio获取JavaScript变量的值?

js variable

从上图,我需要位置的价值。 我正在使用此代码,但它只返回第一个完整的脚本:

function getSecondBody()
{
    url2 = 'http://www.watchfree.to/watch-366-Forrest-Gump-movie-online-free-putlocker.html';
    request(url2, function(err, resp, body)
{
	var $  = cheerio.load(body);
    
	var embedcode = $('script');
	 embedcodetext2 = embedcode;
	console.log(embedcodetext2);
	return embedcodetext2;
});
}

0 个答案:

没有答案