zoukankan      html  css  js  c++  java
  • use snippet save dom to excel

    1.打开贴吧

    http://tieba.baidu.com/f?ie=utf-8&kw=python&fr=search
    

    2.打开console执行下面命令

    Array.prototype.toTable = function() {
    
        var tab = '';
    
        var th = '';
    
        th = "<tr><th>" + keys(this[0]).join('</th><th>') + "</th></tr>";
    
        this.forEach(function(a) {
    
            tab += "<tr><td>" + values(a).join('</td><td>') + "</td></tr>";
    
        });
    
        copy("<table>" + th + tab + "<table>");
    
    };
    
     
    
    var ar = [];
    
    $$('#thread_list > li > div > div.col2_right.j_threadlist_li_right > div.threadlist_lz.clearfix > div.threadlist_title.pull_left.j_th_tit > a')
    
    .forEach(function(a) {
    
    ar.push({ domain: a.href.split('/')[2], url: a.href, title: a.innerHTML});
    
     });
    
    ar.toTable();
    
    

    3.打开一个excel,ctrl+v.自己看效果

  • 相关阅读:
    C# UDP实现通信的方法
    Leetcode 559. N叉树的最大深度
    101. 对称二叉树
    108. 将有序数组转换为二叉搜索树
    剑指 Offer 55
    Linux
    Linux
    Linux
    Linux
    Linux
  • 原文地址:https://www.cnblogs.com/c-x-a/p/10337846.html
Copyright © 2011-2022 走看看