WordRider Home
Welcome! Log In Create A New Profile

Advanced

How to handle "FRAME" fields

Posted by saikek 
How to handle "FRAME" fields
July 07, 2010 08:09AM
Hello *,

I'm creating plugin for [fileshare.in.ua].

After executing code (listed below), i'm redirected to page with
getContentAsString() value as:

Language: HTML
<html> <head> <title>UTF TEXT HERE</title> </head> <FRAMESET rows="57px, *" border="0"> [b]<FRAME src="/3537163?fr" frameborder="0" noresize style="overflow:hidden;"> <FRAME src="/goto.aspx" frameborder="0">[/b] </FRAMESET> </html>

But in browser everything is ok, and contents of this frame contains download link.
What should I do ? Navigate to the aspx file ?

Here is the code:

Language: Java
public void run() throws Exception { super.run(); logger.info("Starting download in TASK " + fileURL); GetMethod getMethod = getGetMethod(fileURL); getMethod.setFollowRedirects(true);   if (makeRedirectedRequest(getMethod)) { checkNameAndSize(getContentAsString());   Matcher matcher = getMatcherAgainstContent("href=\"(.+?)\">UTF TEXT HERE");   if (matcher.find()) { String web_site_address = "http://fileshare.in.ua"; client.setReferer(web_site_address + fileURL); final String redirectURL = web_site_address + matcher.group(1); getMethod = getGetMethod(redirectURL);   if (!makeRedirectedRequest(getMethod)) { throw new ServiceConnectionProblemException(); }

Thank you,
Dima.
Re: How to handle "FRAME" fields
July 07, 2010 03:51PM
Hi!

It's highly recommended to use MethodBuilder to create HttpMethods, as it greatly simplifies almost everything. For example it has several setActionFromXXX methods. The above code written using MerhodBuilder:

Language: Java
public void run() throws Exception { super.run(); logger.info("Starting download in TASK " + fileURL); GetMethod getMethod = getGetMethod(fileURL);   if (makeRedirectedRequest(getMethod)) { checkProblems(); checkNameAndSize(getContentAsString());   HttpMethod httpMethod = getMethodBuilder().setReferer(fileURL).setBaseURL("http://fileshare.in.ua").setActionFromAHrefWhereATagContains("UTF TEXT HERE").toGetMethod(); if (!makeRedirectedRequest(httpMethod)) { throw new ServiceConnectionProblemException(); }   httpMethod = getMethodBuilder().setReferer(httpMethod.getURI().toString()).setBaseURL("http://fileshare.in.ua").setActionFromIframeSrcWhereTagContains("goto.aspx").toGetMethod(); if (!makeRedirectedRequest(httpMethod)) { throw new ServiceConnectionProblemException(); } .....

I didn't test the code above so I'm not certain if it's valid, but I'm sure you get the point.

Oh, and even if the method name says "iframe" it also works for frames.



Edited 1 time(s). Last edit at 07/07/2010 03:52PM by ntoskrnl.
Re: How to handle "FRAME" fields
July 08, 2010 07:44AM
Thank you very much!!!!
It's working.
Sorry, only registered users may post in this forum.

Click here to login