提琴手脚本

编程入门 行业动态 更新时间:2024-10-25 15:28:28
本文介绍了提琴手脚本-SaveResponseBody()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想将所有与某些网页一起加载的png图像保存到单独的文件夹中.我正在Fiddler脚本[CustomRules.js]中使用以下代码.

I want to save all png images that are loaded along with some webpage into a separate folder. I am using below code with in Fiddler Script [CustomRules.js].

static function OnBeforeResponse(oSession: Session) { if(oSession.url.EndsWith(".png")) { oSession.SaveResponseBody(); } //Actual content of OnBeforeResponse function. }

问题在这里,我找不到程序文件/文档中保存的任何图像.

Problem here is, I was unable to find any image got saved within Program files/Documents.

"SaveResponseBody()"将在何处保存HTTP响应正文?

Where do "SaveResponseBody()" will save the HTTP Response Body?

我们可以给我们自己的自定义文件夹吗?

Can we give our own custom folder?

我的Fiddler版本是(v4.4.5.6)

My Fiddler version is (v4.4.5.6)

推荐答案

默认的 SaveResponseBody()方法将文件保存到您的 \ Documents \ Fiddler2 \ Captures \ 文件夹中.如果要使用其他名称,请使用接受文件名的重载.您应该检查Response的状态码为200,以确保您不试图保存不包含正文的HTTP/304响应.另外,您可能不希望查看URL,而是要检查响应的类型.

The default SaveResponseBody() method saves the files to your \Documents\Fiddler2\Captures\ folder. If you want to use a different name, use the overload that accepts a filename. You should check the Response's status code is 200 to ensure that you're not trying to save off HTTP/304 responses which won't contain a body. Also, rather than looking at the URL, you probably want to check the response's type.

因此,您最终得到的是这样的东西:

So you end up with something like this:

if ((oSession.responseCode == 200) && oSession.oResponse.headers.ExistsAndContains("Content-Type", "image/png")) { SaveResponseBody("C:\\temp\\" + oSession.SuggestedFilename); }

注意:手动执行此操作的方法是转到"Web会话"列表下方的QuickExec框,键入 select png 并按Enter,然后单击文件">导出">选定的会话">原始文件"

Note: The manual way of doing this would be to go to the QuickExec box below the Web Sessions list, type select png and hit Enter, then click File > Export > Selected Sessions > Raw Files.

更多推荐

提琴手脚本

本文发布于:2023-10-10 22:43:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1479965.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   提琴手

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!