adambot has asked for the wisdom of the Perl Monks concerning the following question:
with out the ->text i get undef, with the ->text i get an error saying that you can't get text from an undefined item. I'm trying to use the css selector that i got from chrome and firefox (where the chrome one is above and the firefox selector is: html.js body div#wrapper div#main div#right div#content table tbody tr td.section div div#compareprofile table#tableprofile tbody tr td.data but either way i never get any results#!/usr/bin/perl use warnings; use strict; use diagnostics; use LWP::Curl; use Mojo::DOM; use Data::Dumper; my $lwpcurl = LWP::Curl->new(); my $content = $lwpcurl->get('http://puzzledragonx.com/en/monster.asp?n +=1645'); my $dom = Mojo::DOM->new($content); my $result = $dom->at('#tableprofile > tbody > tr:nth-child(1) > td.da +ta')->text; print Data::Dumper::Dumper($result);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CSS Selector in Perl
by Corion (Patriarch) on Dec 20, 2015 at 10:46 UTC | |
|
Re: CSS Selector in Perl
by Anonymous Monk on Dec 20, 2015 at 10:47 UTC | |
by adambot (Acolyte) on Dec 20, 2015 at 14:39 UTC | |
|
Re: CSS Selector in Perl
by kcott (Archbishop) on Dec 20, 2015 at 23:25 UTC |