从 fiddler 核心获取 img src 属性

Getting the img src property from fiddler core

如何从 fiddler core 获取 img src 属性?我想获取蓝色高亮的值

                Fiddler.FiddlerApplication.BeforeRequest += delegate (Fiddler.Session oS) {
                //Console.WriteLine("Before request for:\t" + oS.fullUrl);
                    Console.WriteLine(oS.oRequest.headers.RequestPath.ToString());
                // In order to enable response tampering, buffering mode must
                // be enabled; this allows FiddlerCore to permit modification of
                // the response in the BeforeResponse handler rather than streaming
                // the response to the client as the response comes in.

                if ((oS.responseCode == 200) && oS.oResponse.headers.ExistsAndContains("Content-Type", "image/"))
                {
                    //Console.WriteLine("giving url");
                    //Console.WriteLine(oS.GetRedirectTargetURL());
                }//oS.bBufferResponse = true;
            };

            Fiddler.FiddlerApplication.BeforeResponse += delegate (Fiddler.Session oS) {
                if ((oS.responseCode == 200) && oS.oResponse.headers.ExistsAndContains("Content-Type", "image/"))
                {
                    oS.utilDecodeResponse();
                    //Console.WriteLine("writing bytes");
                    //Console.WriteLine(oS.GetRedirectTargetURL());

                    //Console.WriteLine(oS.responseBodyBytes.ToString());
                    // oS.responseBodyBytes is a byte[] containing the image
                    //Image img = Image.FromStream(new MemoryStream(oS.requestBodyBytes));
                    //Bitmap oBMP = new Bitmap(new MemoryStream(oS.responseBodyBytes));

                    //Console.WriteLine("{0}:HTTP {1} for {2}", oS.id, oS.responseCode, oS.fullUrl);
                    // Now oBMP is an image object which contains the picture...
                }

                // Uncomment the following two statements to decompress/unchunk the
                // HTTP response and subsequently modify any HTTP responses to replace 
                // instances of the word "Microsoft" with "Bayden"
                //oS.utilDecodeResponse(); oS.utilReplaceInResponse("Microsoft", "Bayden");
                //Console.WriteLine("\n");
                //Console.WriteLine("fininihs");

            };

            Fiddler.FiddlerApplication.AfterSessionComplete += delegate (Fiddler.Session oS) { //Console.WriteLine("Finished session:\t" + oS.fullUrl);
                if ((oS.responseCode == 200) && oS.oResponse.headers.ExistsAndContains("Content-Type", "image/"))
                {
                    //Console.WriteLine("giving url");
                    //Console.WriteLine(oS.GetRedirectTargetURL());
                }
            };

我必须在哪一部分放置我的代码?请求前?反应前?还是 AfterSession?

看起来这就是请求 header。您可能会在 BeforeRequest 中使用以下内容检查它:

var src = oS.oRequest.headers.Exists("src") ? oS.oRequest.headers["src"] : "",

BeforeResponse 中您可以获得完整的 url 图像。

var url = oS.fullUrl;