help with xpath

Im trying to take the score rating for each game. (which can be found down the right hand of the page in a red box)

Im using a query

select * from html where url='http://uk.pc.ign.com/articles/104/1042996p1.html' and xpath='/html/body/div[6]/div/div[3]/div[5]/div[2]/div/div[2]/div/div/a'

The return is
<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:count="0" yahoo:created="2009-11-09T06:45:12Z" yahoo:lang="en-US" yahoo:updated="2009-11-09T06:45:12Z" yahoo:uri="http://query.yahooapis.com/v1/yql?q=select+*+from+html+where+url%3D%27http%3A%2F%2Fuk.pc.ign.com%2Farticles%2F104%2F1042996p1.html%27+and+xpath%3D%27%2Fhtml%2Fbody%2Fdiv%5B6%5D%2Fdiv%2Fdiv%5B3%5D%2Fdiv%5B5%5D%2Fdiv%5B2%5D%2Fdiv%2Fdiv%5B2%5D%2Fdiv%2Fdiv%2Fa%27">
<url execution-time="67" proxy="DEFAULT"><![CDATA[http://uk.pc.ign.com/articles/104/1042996p1.html]]></url>

Im guessing there is something wrong with my xpath.
Help please smile.gif

2 Replies
  • Actually the problem is that they don't have the information in the page and use a webservice to fill it in after page load. I created an open data table for their web service and here is the query that grabs the object id from the page and queries it:

    select * from ign.object where id in (select match1 from regex where text in (select href from html where url='http://uk.pc.ign.com/articles/104/1042996p1.html' and xpath='//a[@id="gameProfileLink"]') and expression="objects/[0-9]+/([0-9]+).html")

    Here is a link to execute the query: http://y.ahoo.it/Xy9rtxPs
  • Thanks that worked a charm.
    Do you mine making one for the pcgamer website please.


Recent Posts

in YQL