HTML::...gerize(3pm)

πŸ“¦
version 0.02 Β· 2 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

πŸ’– HTML::AutoPagerize πŸ’–

okay bestie, so this is a page from the Perl manual β€” <pink>HTML::...gerize(3pm)</pink>, the 3pm bit meaning it's a module page for Perl, and yes the header got truncated because somebody's terminal was being dramatic. sit down, grab a boba, we're doing this.


✨ NAME ✨

HTML::AutoPagerize β€” a whole little utility module whose entire job is loading up SITEINFO stuff for AutoPagerize. that's it. that's the vibe. πŸŽ€


🌸 SYNOPSIS 🌸

here's how you actually use it, and listen, copy this exactly because the code is code:

use HTML::AutoPagerize;

my $autopager = HTML::AutoPagerize->new;
$autopager->add_site(
    url         => 'http://.+.tumblr.com/',
    nextLink    => '//div[@id="content" or @id="container"]/div[last()]/a[last()]',
    pageElement => '//div[@id="content" or @id="container"]/div[@class!="footer" or @class!="navigation"]',
);

my $uri  = 'http://otsune.tumblr.com/';
my $html = LWP::Simple::get($uri);

my $res = $autopager->handle($uri, $html);
if ($res) {
    my $next_link = $res->{next_link};    # URI object
    my $content   = $res->{page_element}; # XML::XPathEngine::NodeSet object. may be empty
}

like, add_site takes your url, your nextLink and your pageElement, and handle gives you back a hashref where next_link is a URI object and page_element is an XML::XPathEngine::NodeSet object that may be empty β€” so check if ($res) before you go reaching into it, mkay? πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

HTML::AutoPagerize is a utility module for loading the SITEINFO that's defined over in AutoPagerize. and AutoPagerize itself? it's a userscript whose whole thing is automatically figuring out the "next link" of whatever page you're on, then fetching that content and inserting it in by extracting the "page element". infinite scroll energy, honestly. main character behaviour. ✨


πŸ‘‘ AUTHOR πŸ‘‘

Tatsuhiko Miyagawa <miyagawa@bulknews.net> β€” icon, legend, wrote the thing 🫢


πŸ’œ LICENSE πŸ’œ

this library is free software; you can redistribute it and/or modify it under the exact same terms as Perl itself. so, y'know. same deal as Perl. go wild responsibly.


🌈 SEE ALSO 🌈


ngl this page is short but it ate. every option, every object type, every link β€” all present and accounted for. no cap. πŸ’―

and that's a wrap! this gorgeous little page was brought to you by perl v5.32.0, dated 2021-01-07, and it lives in the HTML::...gerize(3pm) section of your friendly neighbourhood manual. mwah. πŸ’–βœ¨πŸŒΈ

πŸ“¦ where this page comes from