NAME
WWW::Yandex::Catalog::LookupSite - Query Yandex Catalog for a website's presence, it's Index of Citing, descriptions in the catalog, and the list of categories it belongs to.
SYNOPSIS
use WWW::Yandex::Catalog::LookupSite;
my $site = WWW::Yandex::Catalog::LookupSite->new();
$site->yaca_lookup('www.slovnik.org');
print $site->tic . "\n";
print $site->short_description . "\n";
print $site->long_description . "\n";
print "$_\n" foreach @{$site->categories};
DESCRIPTION
The WWW::Yandex::Catalog::LookupSite
module retrieves website's Thematic Index of Citing, and checks website's presence in Yandex Catalog, retrieves it's descriptions as recorded in the catalog, and the list of categories it belongs to.
This module uses LWP::Simple
for making requests to Yandex Catalog.
Data retrieved
Thematic Index of Citing (tIC) is technology of Yandex similar to Google's Page Rank. The tIC value's step is 10, so when tIC is under 10, this module will return 0.
Each website in the Yandex Catalog has short description.
Not every website in the Yandex Catalog has long description.
Every website in the Yandex Catalog will belong to at least one category. It may belong to several other categories as well.
Yandex Catalog may know the website by different uri.
We also know the order number (position) of the site in the main catogory where it is listed.
CONSTRUCTOR
WWW::Yandex::Catalog::LookupSite->new()
Creates and returns a new WWW::Yandex::Catalog::LookupSite
object.
my $site = WWW::Yandex::Catalog::LookupSite->new();
DATA-FETCHING METHODS
$site->yaca_lookup( $uri )
Given a URL/URI, strips unnessesary data from it (scheme, authentication, port, and query), fetches Yandex Catalog with it, and parses results for data.
Returns an array ref to: [ tIC, short description, long description, [ catalogs ], uri, ordinal number ]
. Returns undef
if couldn't fetch the URI.
Short and long description are returned as provided by Yandex, in UTF8 encoding.
Catalogs is an array of strings in format similar to "Auto & Moto / Motorcycles / Yamaha
". The leading "Catalog /
" is striped, I don't believe there're any sites in root of the Catalog.
uri
is returned as stored in the Catalog, which can be defferent from the input URI. For example, with/without www
prefix, or even completely different address (www.narod.ru -> narod.yandex.ru
).
The listing number in the main catogory. Note, that only order in the main catogory is available. For any additional categories this information is currently not provided.
- tIC
-
undef
- if there was an error getting or parsing data. Numeric string with tIC value otherwise. This value (zero or greater, with 10 points step) is always returned. tIC value of zero indicates that eihter site's tIC value is really very low (under 10), or that such site does not exist. - Short Description
-
Returned only when site is present in the Catalog (in UTF8 encoding);
undef
otherwise. - Long Description
-
Can be
undef
when site is present in the Catalog -- not all sites in the catalog have long description. Returned in UTF8 encoding. - Categories
-
Empty list is returned when site is not present in Catalog. At least one entry when present in the catalog.
- URI
-
Address as stored in the Catalog (see notes above).
- Ordinal number
-
Returned only when site is present in catalog;
undef
otherwise.
CONVENIENCE METHODS
These methods can be called only after $site->yaca_lookup( $uri )
$site->is_in_catalog
Returns 1
if any categories has been retrieved; 0
otherwise.
$site->tic
$site->short_description
$site->long_description
$site->categories
print $site->tic . "\n";
if( $site->is_in_catalog ) {
print $site->short_description . "\n";
print $site->long_description . "\n";
print "$_\n" foreach @{$site->categories};
}
$site->uri
$site->order_number
AUTHOR
Irakliy Sunguryan, http://www.slovnik.org/
DEVELOPMENT & BUGS
Repository: https://github.com/OpossumPetya/WWW-Yandex-Catalog-LookupSite.
Please report any bugs at GitHub, RT, or via email bug-www-yandex-catalog-lookupsite at rt.cpan.org
.
LICENSE AND COPYRIGHT
Copyright 2010-2012 Irakliy Sunguryan.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.