网页视频抓取脚本(FBIWARNING具体脚本可以参考前言(图)劫持的姿势 )

优采云 发布时间: 2021-12-16 12:26

  网页视频抓取脚本(FBIWARNING具体脚本可以参考前言(图)劫持的姿势

)

  联邦调查局警告

  具体脚本可以参考

  前言

  之前我们已经学会了xhr劫持的姿势

  现在来实战,通过xhr劫持直接获取返回的内容

  通常通过xhr劫持可以达到两种效果,一是在xhr发送数据前获取并篡改数据,二是在xhr返回后获取数据。

  我们可以输入 %7B%22impr_id%22%3A%225634fdbddc0100fff0030a1217e00000001a54c1a3%22%7D&enter_from=undefined

  通过 f12 抓包

  粗略查了一下资料,发现+(Windows+NT+10.0%3B+Win64%3B+x64)+AppleWebKit%2F537.36+(KHTML,+like+ Gecko )+Chrome%2F92.0.4515.159+Safari%2F537.36&browser_online=true&_signature=_02B4Z6wo00d01gP1vzgAAIDCg.dFeeve9w7dme,我们怀疑是来自mashlist的一个链接想要解密是极其麻烦的,所以这里我们可以直接输入一个xhr劫持来获取返回的内容

  

  在这个网页中,我们可以通过获取视频的视频链接来获取v26开头的前缀,于是我们找了一个json在线格式化工具,粘贴数据并解析,搜索v26

  我发现很多地方都有v26的链接。我挑选了一些进行测试。终于发现video.play_addr.url_list是一个没有水印的链接。

  

  所以这是一个xhr劫持

<p> function addXMLRequestCallback(callback){

var oldSend, i;

if( XMLHttpRequest.callbacks ) {

// we've already overridden send() so just add the callback

XMLHttpRequest.callbacks.push( callback );

} else {

// create a callback queue

XMLHttpRequest.callbacks = [callback];

// store the native send()

oldSend = XMLHttpRequest.prototype.send;

// override the native send()

XMLHttpRequest.prototype.send = function(){

// process the callback queue

// the xhr instance is passed into each callback but seems pretty useless

// you can't tell what its destination is or call abort() without an error

// so only really good for logging that a request has happened

// I could be wrong, I hope so...

// EDIT: I suppose you could override the onreadystatechange handler though

for( i = 0; i < XMLHttpRequest.callbacks.length; i++ ) {

XMLHttpRequest.callbacks[i]( this );

}

// call the native send()

oldSend.apply(this, arguments);

}

}

}

// e.g.

addXMLRequestCallback( function( xhr ) {

xhr.addEventListener("load", function(){

if ( xhr.readyState == 4 && xhr.status == 200 ) {

if(xhr.responseURL.indexOf('/web/aweme/post')!==-1){

console.log('触发了加载')

let list=JSON.parse(xhr.response)

if(list.aweme_list!==undefined){

for(let index=0;index

0 个评论

要回复文章请先登录注册


官方客服QQ群

微信人工客服

QQ人工客服


线