1

I have this page. I want to extract text from html page, particularly table heading (th) and table data (td). For example:

Country: United States (US),State: California where th = Country and td = United States (US).

This is the closest I could get, using xidel:

xidel -A  "Mozilla/5.0" http://www.ip-tracker.org/locator/ip-lookup.php ip=8.8.8.8 -e 'th[1] td[1]'

How do I extract all th and td table entries in the html page?

  • I din't think anyone will do this work for you (for free). I assume you read the manual to xidel. Did you try the Xidel Template tester (videlibri.sourceforge.net/cgi-bin/xidelcgi)? I'm sure this will get you to a solution quickly. And maybe you're lucky and someone did just that and can share their code here. – vic Oct 24 '15 at 9:59
  • @vic your link was helpful. I have reformed my code as follow-- xidel --user-agent "Mozilla/5.0" ip-tracker.org/locator/ip-lookup.php?ip=8.8.8.8 -e "<table> <tbody> <template:loop> <tr> <th> {$field1} </th> <td> {$field2} </td> </tr> </template:loop> </tbody> </table> " I don't get any output. Instead I get a message saying 'current variable state'.Everything looks fine when i checked here videlibri.sourceforge.net/cgi-bin/xidelcgi. Do you have any idea about this? – Swatesh Pakhare Oct 24 '15 at 22:51
  • Great, glad to hear you got it right now :) – vic Oct 24 '15 at 22:54
  • @vic I did not. Read the above comment. I have discussed my problem. – Swatesh Pakhare Oct 24 '15 at 22:57
  • Sorry, I was on mobile and the last two lines were cut.. I can't help you, I don't use xidel. But if your code worked in the (official) template checker, you obviously can't be far from the solution. – vic Oct 24 '15 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.