in reply to Re^3: Running JavaScript from within Perl (or just use the API)
in thread Running JavaScript from within Perl

marto, with regards to your reply on Sep 21, 2019 at 16:31 UTC (which I couldn't figure out how to reply to directly): the code worked (and I'll use it) but gave a warning of "Use of uninitialized value in concatenation (.) or string" at the following line:

print "$feed->{meta}{links}{feed}\n";

Thanks for solving the problem, albeit with a confusing warning.

Replies are listed 'Best First'.
Re^5: Running JavaScript from within Perl (or just use the API)
by marto (Cardinal) on Sep 22, 2019 at 02:17 UTC

    You've edited your site and the JSON now looks like:

    { "feeds": [ { "subscribe_URL": "https:\/\/the-art-of-autism.com\/feed\/", "feed_ID": "34259929", "meta": { "links": { "feed": "https:\/\/public-api.wordpress.com\/rest\/v1\/read\ +/feed\/34259929", "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/read\ +/sites\/57595012" } } }, { "subscribe_URL": "https:\/\/the-art-of-autism.com\/sample-page-2 +\/feed\/", "feed_ID": "", "meta": { "links": { } } }, { "subscribe_URL": "http:\/\/the-art-of-autism.com\/feed\/", "feed_ID": "34259929", "meta": { "links": { "feed": "https:\/\/public-api.wordpress.com\/rest\/v1\/read\ +/feed\/34259929", "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/read\ +/sites\/57595012" } } } ] }

    Note Sample page 2 has no links. A fix for the code:

    my $json = $ua->get( $url )->res->json; for my $feed ( @{$json->{feeds}} ){ if ( $feed->{meta}{links}{feed} ){ print "$feed->{meta}{links}{feed}\n"; } }

    "which I couldn't figure out how to reply to directly" If viewing a node directly you'll see a link reading "Comment on {Node title here}", if viewing in thread mode you'll see a link titled "[reply]" at the bottom right of each reply.