0xHJK / zhihu-fuli

过滤知乎当前页面的图片,以瀑布流形式展现,如果显示不正常,请使用最新版chrome
5 stars 5 forks source link

好像不能用? #1

Closed zsydyc closed 8 years ago

zsydyc commented 8 years ago

error: Mixed Content: The page at 'https://www.zhihu.com/question/32680596' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://www.zhihu.com/node/QuestionAnswerListV2'. This request has been blocked; the content must be served over HTTPS.

zsydyc commented 8 years ago

把两处的http 换成了https就好使了

// 获取变量 var _xsrf = $("input[name='_xsrf']").attr("value"), url_token = $("#zh-question-answer-wrap").data("init").params.url_token, nodename = $("#zh-question-answer-wrap").data("init").nodename, count = $("#zh-question-answer-num").data("num"), stepCount = Math.ceil(count / 50), nowCount = 0, offset = 0;

// 新建节点,隐藏原网页 $("#zh-question-answer-wrap").empty().hide(); $("body").append('

加载中,请稍后...

');

// 主函数 loadImg(offset);

// Ajax获取资源函数 function loadImg(offset){ $.ajax({ url: 'https://www.zhihu.com/node/' + nodename, type: 'POST', dataType: 'json', data: { method: 'next', params: '{"url_token":' + url_token + ',"pagesize":50,"offset":' + offset + '}', _xsrf: _xsrf } }) .done(function(data){ for(idx in data.msg){ $("#zh-question-answer-wrap").append(data.msg[idx]); } nowCount ++; if(nowCount == stepCount){ showImg(); } else { offset += 50; loadImg(offset); }

}); } // Ajax提交已读函数 // function postRead(offset){ // var length = $(".zm-item-answer").length; // var readArr = '['; // for(var i = offset; i < length - 1; i++){ // var answerId = $(".zm-item-answer").eq(i).data("atoken"); // var readItem = '["answer",' + answerId + ', "read"],'; // readArr += readItem; // } // readArr += '["answer",' + $(".zm-item-answer").eq(length - 1).data("atoken") + ', "read"]]'; // $.ajax({ // url: 'https://www.zhihu.com/lastread/touch', // type: 'POST', // dataType: 'json', // data: { // items: readArr, // _xsrf: _xsrf // } // }) // .complete(function(data){ // nowCount ++; // if(nowCount == stepCount){ // showImg(); // } else { // offset += 50; // loadImg(offset); // } // }); // }

// 显示图像函数 function showImg(){ var length=$(".zm-item-rich-text .lazy").length, img = ""; for(var i = 0;i<length;i++){ var src = $(".zm-item-rich-text .lazy").eq(i).data("actualsrc"), people = $(".zm-item-rich-text .lazy").eq(i).parents(".zm-item-answer").find('.zm-item-link-avatar').attr("href"), peoplesrc = people ? people : src, title = people ? people : "匿名用户"; img += '

'; } $("#img-fuli").html(img); }

0xHJK commented 8 years ago

多谢反馈,知乎现在使用了https,这个项目后续没有更新

bumaociyuan commented 8 years ago

XMLHttpRequest cannot load https://www.zhihu.com/node/QuestionAnswerListV2. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.zhihu.com' is therefore not allowed access.

0xHJK commented 8 years ago

@bumaociyuan 使用https://www.zhihu.com访问知乎即可,知乎这个https有点蛋疼啊,有时跳转,有时没跳转……刚刚发现知乎更新了数量限制,晚点会更新代码

bumaociyuan commented 7 years ago

@0xHJK https://gist.github.com/bumaociyuan/32dee0929c68dd8933c25a153eccb5c2 貌似知乎改版了就完全不能用了,改了一波

0xHJK commented 7 years ago

@bumaociyuan 好的,改了一下使用说明,多谢