Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 291779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:07:12+00:00 2026-05-12T06:07:12+00:00

I’m looking for the way to get the direct link from mediafire. By default,

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:07:12+00:00Added an answer on May 12, 2026 at 6:07 am
    • How to make a Get request using
      C#
    • Beyond the basics (Handling cookies)

    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:

    • 1st Response->fetch the value passed
      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.
    • The 2nd response creates this huge
      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):

      string sURL = "http://www.mediafire.com/?syzjuytmdkn";
    
      HttpWebRequest wrGETURL = (HttpWebRequest)WebRequest.Create(sURL);
      wrGETURL.CookieContainer = new CookieContainer();
      wrGETURL.Referer = "http://www.mediafire.com";
      wrGETURL.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
    
      HttpWebResponse wrResponse = (HttpWebResponse)wrGETURL.GetResponse();
      CookieCollection cookies = wrResponse.Cookies;
    

    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:

      StreamReader objReader = new StreamReader(wrResponse.GetResponseStream());
    
      string[] parameters = {};//will contain the parameters fetched
      string html = objReader.ReadToEnd();
      int cupos1 = html.IndexOf("cu(");
      int cupos2 = html.IndexOf("')",cupos1);
      string[] separators = { "','"};
    
      parameters = html.Substring(cupos1 + 4, cupos2 - cupos1 - 4)
                       .Split(separators, StringSplitOptions.None);
    

    Fetch the 2nd page which will contain the encoded download url:

      string sURL2 = String.Format("http://www.mediafire.com/dynamic/download.php?qk={0}&pk={1}&r={2}",
                           parameters[0],parameters[1],parameters[2]);
    
      HttpWebRequest wrGETURL2 = (HttpWebRequest)WebRequest.Create(sURL2);
      wrGETURL2.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)";
      wrGETURL2.Referer = "http://www.mediafire.com";
    
      wrGETURL2.CookieContainer = new CookieContainer();
      wrGETURL2.CookieContainer.Add(cookies);
      wrResponse = (HttpWebResponse)wrGETURL2.GetResponse();
      objReader = new StreamReader(wrResponse.GetResponseStream());
      html = objReader.ReadToEnd();
    

    This html contains the Javascript that will generate the download url, here we extract it, then evaluate it & finaly write it to the console:

      int varpos1 = html.IndexOf("<script language=\"Javascript\">")+35;
      //The variables are declared just before the 'function'
      int varpos2 = html.IndexOf("function",varpos1);
      string vardata = html.Substring(varpos1, varpos2 - varpos1);
    
      int hrefpos1 = html.IndexOf("href=\\\"http://", varpos2)+6 ;
      int hrefpos2 = html.IndexOf(">", hrefpos1);
      string hrefdata = String.Format("var url = {0};", html.Substring(hrefpos1, hrefpos2 - hrefpos1-5));
      object Result = EvalJScript(vardata + "\n" + hrefdata);
      Console.WriteLine(Result.ToString());
    

    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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.