标签归档:chrome

如何下载受限资源

1 通过Chrome的network查找到加载的资源,如 http://cache.gensee.com/gsgetrecord/record14.gensee.net/gsrecord/115291/sbr/2018_05_06/V4AFs46eBy_1525568216/3976114433_145.swf

1

2 尝试通过本地的html页面将单张集成起来,但swf有其特殊性集成失败

3 换个思路,切换到移动版本(现在的手机不支持flash),以同样的方法可以找到图片资源地址,如 http://cache.gensee.com/gsgetrecord/record19.gensee.net/gsrecord/115291/sbr/2018_05_05/V4AFs46eBy_1525499873/hls/3976114433_96.png

4 多找两张看看其规律 http://cache.gensee.com/gsgetrecord/record19.gensee.net/gsrecord/115291/sbr/2018_05_05/V4AFs46eBy_1525499873/hls/3976114433_97.png

5 按照规律写脚本,如下:

   var data = [];
    data.push({
        name:'冲刺1', 
        url:'http://cache.gensee.com/gsgetrecord/record20.gensee.net/gsrecord/115291/sbr/2018_05_05/V4AFs46eBy_1525481655/hls/3976114433_{0}.png',
        end: 95
    },{
        name:'冲刺2', 
        url:'http://cache.gensee.com/gsgetrecord/record19.gensee.net/gsrecord/115291/sbr/2018_05_05/V4AFs46eBy_1525499873/hls/3976114433_{0}.png',
        start: 96,
        end: 144
    },{
        name:'冲刺3', 
        url:'http://cache.gensee.com/gsgetrecord/record14.gensee.net/gsrecord/115291/sbr/2018_05_06/V4AFs46eBy_1525568216/hls/3976114433_{0}.png',
        start: 145,
        end: 202
    },{
        name:'冲刺4', 
        url:'http://cache.gensee.com/gsgetrecord/record20.gensee.net/gsrecord/115291/sbr/2018_05_06/V4AFs46eBy_1525586183/hls/3976114433_{0}.png',
        start: 203,
        end: 344
    });

6 将上述页面生成 html

   var b = 0;
    if(qs && qs['b']){
        b = qs['b'] * 1;
    } else {
        document.title = '系分考试';
        $('content').innerHTML = html;
        return;
    }
    
    
    
    var url = data[b].url;
    var start = data[b].start;
    if(!start){
        start = 0;
    }
    var end = data[b].end;
    var name = data[b].name;
    document.title = '系分考试-' + name;
    
    
    
    

    html += '\n\n';
    for(var i = start;i<=end;i++){
    
        html += '\n\n';
        
        html += '![{0}]({0}) '.format(url.format(i));
        
    }
    console.log(html);
    $('content').innerHTML = html;

7 通过浏览器打印生成pdf

8 完整代码

<!DOCTYPE html>
<html>
<title></title>
<meta http-equiv=Content-Type content="text/html;charset=utf-8">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<link rel="apple-touch-icon" href="images/task/task3.png">
<xmp theme="simplex" style="display:none;" id="content">

</xmp>
<script src="js/tohours.min.js"></script>
<script>
(function(){


    var data = [];
    data.push({
        name:'冲刺1', 
        url:'http://cache.gensee.com/gsgetrecord/record20.gensee.net/gsrecord/115291/sbr/2018_05_05/V4AFs46eBy_1525481655/hls/3976114433_{0}.png',
        end: 95
    },{
        name:'冲刺2', 
        url:'http://cache.gensee.com/gsgetrecord/record19.gensee.net/gsrecord/115291/sbr/2018_05_05/V4AFs46eBy_1525499873/hls/3976114433_{0}.png',
        start: 96,
        end: 144
    },{
        name:'冲刺3', 
        url:'http://cache.gensee.com/gsgetrecord/record14.gensee.net/gsrecord/115291/sbr/2018_05_06/V4AFs46eBy_1525568216/hls/3976114433_{0}.png',
        start: 145,
        end: 202
    },{
        name:'冲刺4', 
        url:'http://cache.gensee.com/gsgetrecord/record20.gensee.net/gsrecord/115291/sbr/2018_05_06/V4AFs46eBy_1525586183/hls/3976114433_{0}.png',
        start: 203,
        end: 344
    });
    
    var $ = function(id){
        return document.getElementById(id);
    }
    
    var html = '';
    for(var i=0;i<data.length;i++){
        if(i%3 == 0){
            html += '\n\n';
        }
        html += '[【{0}】](cc-xf?b={1}) '.format(data[i].name, i);
    }
    html += '\n\n';
    
    html += '<a href="javascript:;" onclick="hideLink()">【关闭】</a> [【首页】](cc-xf)';
    
    
    qs = tohours.queryString();
    var b = 0;
    if(qs && qs['b']){
        b = qs['b'] * 1;
    } else {
        document.title = '系分考试';
        $('content').innerHTML = html;
        return;
    }
    
    
    
    var url = data[b].url;
    var start = data[b].start;
    if(!start){
        start = 0;
    }
    var end = data[b].end;
    var name = data[b].name;
    document.title = '系分考试-' + name;
    
    
    
    

    html += '\n\n';
    for(var i = start;i<=end;i++){
    
        html += '\n\n';
        
        html += '![{0}]({0}) '.format(url.format(i));
        
    }
    console.log(html);
    $('content').innerHTML = html;
})();

function hideLink(){
    var a = document.getElementsByTagName('a');
    for(var i=0;i<a.length;i++){
        a[i].style = 'display:none';
    }
}
</script>
<script src="js/strapdown.js"></script>
</html>