anautismobserver has asked for the wisdom of the Perl Monks concerning the following question:
My goal is to develop an automated means to obtain the number of followers for each of a list of WordPress blog feeds (eg https://wordpress.com/read/feeds/93815501), which display the number of followers in a way that is captured by a copy-and-paste but is not in the HTML page source code. In order for these pages to display properly I need to be logged into a WordPress account and have JavaScript enabled in the browser.
So far I have the following code:
use strict; use warnings; use LWP::UserAgent; use LWP::Simple; use HTML::TreeBuilder; print HTML::TreeBuilder->new_from_url('https://wordpress.com/read/feed +s/94271045')->as_text;
This code produces the following output:
> WordPress.comPlease enable JavaScript in your browser to enjoy WordPress.com.
Naively it seems to me that since my browser can interpret a web page using JavaScript without any a priori information, Perl should be able to as well. Is this possible? If not, why not?
I'm a Perl novice who wants to get code running without learning Perl "from the ground up". My strategy has been to find working code samples that do pieces of what I want, then change them incrementally until they do all I want. I'm using Strawberry Perl on Windows.
Can you offer guidance or link to somewhere that explains it for novices like me? Thank you.