basic Mojo::UserAgent question

75 views
Skip to first unread message

j.kenneth fraac

unread,
Feb 21, 2015, 2:46:43 AM2/21/15
to mojol...@googlegroups.com
I'm really new to web stuff, I've only used LWP::Simple to get pages, but this isn't adequate to get the numbers from the table here: <http://sizzlingstats.com/stats/200996>. Mojo::UserAgent seems strong enough but what would the 'get' look like?

cheers

Stefan Adams

unread,
Feb 21, 2015, 9:41:08 AM2/21/15
to mojolicious
On Sat, Feb 21, 2015 at 1:46 AM, j.kenneth fraac <fra...@gmail.com> wrote:
I'm really new to web stuff, I've only used LWP::Simple to get pages, but this isn't adequate to get the numbers from the table here: <http://sizzlingstats.com/stats/200996>. Mojo::UserAgent seems strong enough but what would the 'get' look like?

I'm not sure exactly what numbers you're looking for, but it looks like there's a great deal of info from JSON docs within the api version of the URL:


$ cat /tmp/stats
use Mojolicious::Lite;
#say app->dumper($tx->res->json);
say app->dumper($tx->res->json->{stats}->{bluscore}->[2]);

$ perl /tmp/stats

j.kenneth fraac

unread,
Feb 23, 2015, 4:41:01 AM2/23/15
to mojol...@googlegroups.com
Thanks, that's perfect. How did you know to get sizzlingstats.com/api/stats/...? I was looking around for ages for something like that. Is it just standard?

Stefan Adams

unread,
Feb 23, 2015, 11:26:35 AM2/23/15
to mojolicious


On Feb 23, 2015 3:41 AM, "j.kenneth fraac" <fra...@gmail.com> wrote:
>
> Thanks, that's perfect. How did you know to get sizzlingstats.com/api/stats/...? I was looking around for ages for something like that. Is it just standard?

I used Chrome Developer Tools (ctrl-shift-i) to see all the web requests and responses that the browser was doing on my behalf for the content I was looking for.  I scanned through the full list and found the one most logical to contain the content you were asking about.  You can also sort by content type and look for your JSON contents that way (application/json).

Reply all
Reply to author
Forward
0 new messages