I’m looking for the way to get the direct link from mediafire. By default, when a user visits a download link, he will be presented with a download page where he has to wait for the download to be processed and then a link will appear.
I googled and found a VB.NET 2008 solution to this using WebBrowser WB
http://www.vbforums.com/showthread.php?t=556681
It works pretty well but I’m tired of pop-up windows and the loading speed. So, I wonder if there is a solution to this problem? (a non WB solution ^^)
Any help is greatly appreciated.
C#
I’ll be posting back when I’ve worked the regular expression into the code, not sure this is going to work though as I think the actual link is obtained through AJAX. I’m still playing with this.
AJAX concerns discussed: StackOverflow related question
Based on the php code provided in the comments:
to a function called
“cG(var1,var2,var3)” I don’t think
mediafire still uses that function,
it seems it’s called
“cu(var1,var2,var3)” now, not sure if
the php you gave will still work.
anyway, we can do the same thing get
the values from the cu function &
post our request to
http://www.mediafire.com/dynamic/download.php?
with the cookie we retrieved from our
first response.
list of random generated variables,
then generates the download url
concatenating some of those
variables, the only way to get the
url out if this is by using the
Microsoft.JScript engine to evaluate
this code. I’ll be posting my
code asap
Code (warning this code is ugly & needs to be cleaned up):
Here we send the first request & Store the cookies received. Next we want to parse the page to find out the keys for the 2nd request:
Fetch the 2nd page which will contain the encoded download url:
This html contains the Javascript that will generate the download url, here we extract it, then evaluate it & finaly write it to the console:
This stuff worked for me, but needs to be rewritten, I also leave the EvalJScript function for you to work as the one I’m using (from Evaluating JScript in c#) is deprecated