Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl6
- #
- use LWP::Simple;
- use URI::Escape;
- use Cro::HTTP::Client;
- use LibCurl::Easy;
- use Grammar::Debugger;
- use HTML::Parser::XML;
- use DOM::Tiny;
- grammar Docdata {
- token TOP {<record>+}
- token record { <cell>||<not_comp> }
- token cell {\s*'<TD'\s*<align>'>'\s*<content>'</TD>'\s*}
- token align {<-[>]>*}
- token content {\s*<date_time_form>*[<!before '</TD>'>.]*}
- token date_time_form {<date>||<time>||<form>}
- rule date {<month>\s<day>\s<year>}
- token time {<{[0 ... 23]».fmt('%02d')}>':'<{[0 ... 60]».fmt('%02d')}>':'<{[0 ... 60]».fmt('%02d')}>\s'ET'}
- token month {'Jan'||'Feb'||'Mar'||'Apr'||'May'||'Jun'||'Jul'||'Aug'||'Sep'||'Oct'||'Nov'||'Dec'}
- token day {<{[1 ... 31]}>}
- token year {<{[1900 ... 2100]}>}
- token form {\s*'<FORM'.*'</FORM>'\s*}
- token link {[<!before '</FORM>'>.]*}
- token not_comp {\V*\v}
- }
- my %formdata = lang => "EN", page_no => "1", company_search => "Wells Fargo", document_selection => "0", industry_group => "A", FromMonth => "05", FromDate => "24", FromYear => "2017", ToMonth => "11", ToDate => "24", ToYear => "2017", Variable => "Issuer", Search => "Search";
- my $resp = await Cro::HTTP::Client.post: "http://www.sedar.com/FindCompanyDocuments.do", headers => [ User-agent => 'Mozilla/5.0 (X11; Fedora; Linux x86_64)'], content-type => 'application/x-www-form-urlencoded', body => %formdata;
- my $content = await $resp.body;
- my $dom = DOM::Tiny.parse($content);
- my $table = $dom.at('table');
- say $table.all-text;
Add Comment
Please, Sign In to add comment