A
A
AnthonyCherepkov2012-11-06 22:09:32
Perl
AnthonyCherepkov, 2012-11-06 22:09:32

How to set up parsing of an html page in Perl?

Hello.
Please tell me how to parse the following from the page www.efremova.info/word/slovar.html :
Книга, содержащая перечень слов, их частей или словосочетаний с пояснениями, толкованиями или с переводом на другой язык.
Thank you very much, kind people.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
alexbyk, 2012-11-06
@alexbyk

#!/usr/bin/env perl
use Mojo::Base -strict;
use Mojo::UserAgent;

my $uri = 'http://efremova.info/word/slovar.html';
my $sel = 'td#centerCnt ol li';

my $ua   = Mojo::UserAgent->new();

my $text = $ua->get($uri)->res->dom->at($sel)->text;

Just don't forget about encoding and checking the response

V
vsespb, 2012-11-06
@vsespb

regexpom
$body =~ /<li><a name="so1"><\/a>([^\"]+)/ ; print $1;

A
Alexander Skipped, 2013-04-05
@Foxcool

There is also an excellent parser metacpan.org/module/Web ::Scraper
I really enjoyed working with it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question