GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
WWW::Mixi::Scraper::Plugin(3) User Contributed Perl Documentation WWW::Mixi::Scraper::Plugin(3)

WWW::Mixi::Scraper::Plugin - base class for plugins

    package WWW::Mixi::Scraper::Plugin::<SamplePlugin>

    use strict;
    use warnings;
    use WWW::Mixi::Scraper::Plugin;

    validator {qw( id is_number )};

    sub scrape {
      my ($self, $html) = @_;

      my %scraper;
      $scraper{...} = scraper {
        process '...',
          text => 'TEXT';  # always plain text
        process '...',
          text => 'HTML';  # always HTML
        process '...',
          depends => $self->html_or_text; # HTML or TEXT
        result qw( text depends );
      };

      return $self->post_process($scraper{...}->scrape(\$html));

      return $arrayref;
    }

    1;

This is a base class for WWW::Mixi::Scraper plugins. You don't need to "use base qw( WWW::Mixi::Scraper::Plugin )"; just "use" it. This exports Web::Scraper functions and several public and private methods/functions of its own.

creates an object.

returns the rendering mode of choice ('TEXT' or 'HTML').

gets content from a uri, scrapes, and returns an array (or a hash reference, etc) of data.

used internally to build uri from query paramters (and optional hash). If you want to tweak the uri (e.g. to change authority from 'mixi.jp' to 'video.mixi.jp', etc), provide "tweak_uri()" in your plugin.

gets content from the uri specified or from an optional html data.

does some common tasks such as to make sure the result be an array reference, remove some temporary data to extract exact information, objectify link data (and maybe datetime data in the future?).

prepares some simple validator for query parameters, though I'm not sure if this is really useful.

Kenichi Ishigaki, <ishigaki at cpan.org>

Copyright (C) 2007 by Kenichi Ishigaki.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2022-04-12 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.