SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Enthusiast xarzu's Avatar
    Join Date
    Apr 2007
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How does Yandex do its trick?

    How does Yandex do its trick?

    I want to programatically get the contents of a Yandex.com search result.

    The proglem is that a search page url does not change when you do a search on yandex.com and advance to see more pages. It must be done somehow by javascript. Any ideas?

  2. #2
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by xarzu View Post
    The proglem is that a search page url does not change when you do a search on yandex.com and advance to see more pages. It must be done somehow by javascript. Any ideas?
    It does use JavaScript, but you can also get the next page's results by simply appending a "p" parameter on to the URL.

    For example:
    http://www.yandex.com/yandsearch?text=javascript
    http://www.yandex.com/yandsearch?text=javascript&p=2
    http://www.yandex.com/yandsearch?text=javascript&p=3
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }

  3. #3
    SitePoint Enthusiast xarzu's Avatar
    Join Date
    Apr 2007
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AussieJohn View Post
    It does use JavaScript, but you can also get the next page's results by simply appending a "p" parameter on to the URL.

    For example:
    http://www.yandex.com/yandsearch?text=javascript
    http://www.yandex.com/yandsearch?text=javascript&p=2
    http://www.yandex.com/yandsearch?text=javascript&p=3
    That works.

    Thanks.

    How did you figure this out?

    Another web site search engine also does this trick. I am talking about www.duckduckgo.com which is also a very popular search engine. It too does not display a different URL in the address bar of the browser as I advance through more content.

    And the display for
    http://duckduckgo.com/?q=javascript&p=100
    is no different from
    http://duckduckgo.com/?q=javascript

    When I tried
    http://duckduckgo.com/?q=javascript&page=1
    it thew a 403 forbidden error.

  4. #4
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by xarzu View Post
    That works.

    Thanks.

    How did you figure this out?
    I looked in Chrome Web Developer Tools to see what URL the AJAX request was being made to when the "More" button was clicked. Had a look at all the parameters and "p" was one that was changing with every request, so I figured I'd try it out in the main URL to see what would happen
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }

  5. #5
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,192
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    DuckDuckGo uses a <noscript> tag to display a message asking uses without JavaScript to visit https://duckduckgo.com/html which uses straight up page reloads to paginate the results using the POST method. Other then that it offers no other way of manually going through the results when JavaScript is enabled.

    https://duckduckgo.com/html/?q=javascript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •