Skip to content

Instantly share code, notes, and snippets.

@huanggm
Created April 13, 2016 10:27
Show Gist options
  • Save huanggm/d57bc135bffa2bb086d6ff96a6458617 to your computer and use it in GitHub Desktop.
Save huanggm/d57bc135bffa2bb086d6ff96a6458617 to your computer and use it in GitHub Desktop.
抓取京东左侧列表数据,返回一个数组
a=$('.subitems').map(function() {
return $(this).find('dl').map(function() {
var res = {}, $this = $(this);
var name = $this.children('dt').text().slice(0, -1);
res[name] = $this.children('dd').children('a').map(function() { return $(this).text(); }).get();
return res;
}).get();
}).get();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment