Communicate with Flash object from WebBrowser with C# .Net
I am trying to make myself a simple metacafe uploader, and I am using the webbrowser to do that. Everything was working great with loggin in, naviga开发者_开发问答ting to upload page etc... I used the HtmlElement and setAttribute/Invoke to click and set the text fields:
HtmlElement password = wb.Document.All["sPass"]; assword.SetAttribute("value", this.password);
Now I have a problem. To upload a video to metacafe, you first need to click on a flash button caleld Upload. There, a window appears to select a file, and after you press OK, the upload begins and you can enter the form information. My question is this: How can I enter the video file without seeing a popup window? Knowing that it's flash . Here is how the flash object looks:
http://www.sodevrom.net/sample.html
Above I copied only the part from the upload page that it's important to me. As you can see, a simple flash file appears. Now I want to simulate the click/enter of file without showing the file window.
Any ideas on how I can do this? Thanks
I would recommend this:
- Get Firefox and FlashTracer (or another add-on that allows inspection of packets sended by the Flash applet to the server).
- Emulate and send those packets using C#.
I've already done that using C#, but not with Metacafe. Apparently they do not have any kind of open API to make things easier, so I guess you do not have any other option.
BTW, are you sure that you are allowed (legally) to do that?
In the end I used HTTPanalyzer to track all the requests made by the flash application. I analyzed all requests and created my own POST/GET class to make things happen.
So whenever you don't know what's going in the background, try the software I stated above and track all http requests.
精彩评论