How do you programmatically expand a url link to its true location?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xarzu
    New Member
    • Apr 2007
    • 90

    How do you programmatically expand a url link to its true location?

    How do you programmaticall y expand a url link to its true location?

    Do you know about tinyurl.com and baidu.com? Baidu.com is a search engine that tries to discourage people from using their web site to make metasearch engines by hiding their links in a way that is a lot like how tinyurl.com works. TinyUrl.com is a web site where, if you want to present someone with a link to something and that link is long, you can use tinyurl to produce a tiny url for presentation purposes.

    Anyway, what I want to do is to find a way to programmaticall y take the link http://www.baidu.com/link?url=mW91GJ qjJ4zBBpC8yDF8x DhiqDSn1JZjFWsH hEoSNd85PkV8Xil 7qccoOX3rynaE (the first link in a search for Jessica Alba using baidu.com) and have it return the actual link, http://baike.baidu.com/view/270790.htm . That is just one example. What I want to do is not specific to Jessica but for using Baidu.com as part of my group of search engines in my meta search eneing project.

    Maybe there is a way of using the WebBrowser class but I did not see a member that was the URL.

    Maybe there is a way of using WebRequest and WebResponse.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You'll have to automate visiting the site and letting it resolve fully and then grab the url.

    Also, the web browser class does have a URL property.

    Comment

    • xarzu
      New Member
      • Apr 2007
      • 90

      #3
      Originally posted by Rabbit
      You'll have to automate visiting the site and letting it resolve fully and then grab the url.

      Also, the web browser class does have a URL property.
      How does one grab the URL?

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You mean from a web browser object?
        Code:
        webbrowser.url

        Comment

        • xarzu
          New Member
          • Apr 2007
          • 90

          #5
          Is that with WPF?

          With WPF:

          Code:
          WebBrowser webbrowser1;
          
          webbrowser1.url <-- does not exist.

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Here is microsoft's documentation on the url property of the web browser class.

            Comment

            • xarzu
              New Member
              • Apr 2007
              • 90

              #7
              It is too bad I am not using windows forms

              Comment

              • Rabbit
                Recognized Expert MVP
                • Jan 2007
                • 12517

                #8
                In that case, you can use the source property.

                Comment

                • xarzu
                  New Member
                  • Apr 2007
                  • 90

                  #9
                  Cool.

                  I will give it a try.

                  Thanks.

                  Comment

                  Working...