WWW::FetchStory::Fetcher - fetching module for WWW::FetchStory
version 0.1815
This is the base class for story-fetching plugins for WWW::FetchStory.
$obj->WWW::FetchStory::Fetcher->new();
Initialize the object.
$obj->init(%args)
The name of the fetcher; this is basically the last component of the module name. This works as either a class function or a method.
$name = $self->name();
$name = WWW::FetchStory::Fetcher::name($class);
Information about the fetcher. By default this just returns the formatted name.
$info = $self->info();
The priority of this fetcher. Fetchers with higher priority get tried first. This is useful where there may be a generic fetcher for a particular site, and then a more specialized fetcher for particular sections of a site. For example, there may be a generic LiveJournal fetcher, and then refinements for particular LiveJournal community, such as the sshg_exchange community. This works as either a class function or a method.
This must be overridden by the specific fetcher class.
$priority = $self->priority();
$priority = WWW::FetchStory::Fetcher::priority($class);
If this fetcher can be used for the given URL, then this returns true. This must be overridden by the specific fetcher class.
if ($obj->allow($url)) { .... }
Fetch the story, with the given options.
%story_info = $obj->fetch( urls=>\@urls, basename=>$basename, toc=>0, yaml=>0);
Optional basename used to construct the filenames. If this is not given, the basename is derived from the title of the story.
Create an EPUB file, deleting the HTML files which have been downloaded.
Build a table-of-contents file if this is true.
Build a YAML file with meta-data about this story if this is true.
The URLs of the story. The first page is scraped for meta-information about the story, including the title and author. Site-specific Fetcher plugins can find additional information, including the URLs of all the chapters in a multi-chapter story.
Figure out the file basename for a story by using its title.
$basename = $self->get_story_basename($title);
Extract the story-content from the fetched content.
my ($story, $title) = $self->extract_story(content=>$content, title=>$title);
Create site-specific CSS styling.
$css = $self->make_css();
Make a tidy, compliant XHTML page from the given story-content.
$content = $self->tidy(story=>$story, title=>$title);
Get a table-of-contents page.
Get the contents of a URL.
Parse the table-of-contents file.
%info = $self->parse_toc(content=>$content, url=>$url, urls=>\@urls);
This should return a hash containing:
An array of URLs for the chapters of the story. In the case where the story only takes one page, that will be the chapter. In the case where multiple URLs have been passed in, it will be those URLs.
The title of the story.
It may also return additional information, such as Summary.
Figure out the URLs for the chapters of this story.
Figure out the URL for the EPUB version of this story, if there is one.
Get the title from the content
Get the chapter title from the content
Get the author from the content
Get the summary from the content
Get the characters from the content
Get the universe/fandom from the content
Get the recipient from the content
Get the categories from the content
Get the rating from the content
Calculate additional Meta values, such as current date.
Get an individual chapter of the story, tidy it, and save it to a file.
$filename = $obj->get_chapter(base=>$basename, count=>$count, url=>$url, title=>$title);
Get the EPUB version of the story, tidy it, and save it to a file.
$filename = $obj->get_epub(base=>$basename, url=>$url);
Replace or add the description to an EPUB file.
Add the given meta-data to an EPUB file.
Parse a node of meta-information from an EPUB file.
Figure out the word-count.
Build a local table-of-contents file from the meta-info about the story.
$self->build_toc(info=>\%info);
Create an EPUB file from the story files and meta information.
$self->build_epub()
Remove nasty encodings.
$content = $self->tidy_chars($content);
To install WWW::FetchStory, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::FetchStory
CPAN shell
perl -MCPAN -e shell install WWW::FetchStory
For more information on module installation, please visit the detailed CPAN module installation guide.