3 WWW::Quvi - Perl extension interface for libquvi
8 my $q = new WWW::Quvi::Query;
9 my $m = $q->parse($url);
10 croak "error: $q->{errmsg}" unless $q->{ok};
14 WWW::Quvi provides a Perl interface to libquvi, a small C library for
15 parsing Flash media stream URLs. It is written in C++ and uses SWIG to
16 connect to the libquvi API.
20 This module provides a Perl interface to libquvi. This documentation
21 contains the Perl specific details and some sample code. The libquvi
22 documentation should be consulted for the API details at
23 L<http://quvi.sourceforge.net/>.
25 =head1 WWW::Quvi::version
27 A wrapper function that returns WWW::Quvi version and libquvi version
30 WWW::Quvi::version; # Module version
31 WWW::Quvi::version(WWW::Quvi::ModuleVersion); # Ditto.
32 WWW::Quvi::version(WWW::Quvi::libquviVersion);
33 WWW::Quvi::version(WWW::Quvi::libquviVersionLong);
37 C<$WWW::Quvi::VERSION> is also available
39 =head1 WWW::Quvi::Options
41 A container hash for the options used with libquvi that would normally
42 (using the C API) be set with C<quvi_setopt(3)>.
44 $opts->{verbose_libcurl} = 1; # Default: 0
45 $opts->{user_agent} = 'Foo/1.0'; # Default: ""
46 $opts->{http_proxy} = 'http://foo:1234'; # Default: ""
47 $opts->{category} = WWW::Quvi::ProtoHttp; # Default: ProtoAll
48 $opts->{resolve} = 0; # Default: 1
49 $opts->{format} = 'best'; # Default: "default"
50 $opts->{verify} = 0; # Default: 1
52 =head1 WWW::Quvi::Media
54 A container hash that holds the parsed media details accessible using
57 $media->{content_length} # Content length as returned by the server
58 $media->{thumbnail_url} # Thumbnail URL (if any)
59 $media->{content_type} # Content-type as returned by the server
60 $media->{file_suffix} # File suffix parsed from the content-type
61 $media->{start_time} # Start time for media (if any)
62 $media->{page_title} # Media title
63 $media->{page_url} # Page URL
64 $media->{duration} # Duration in msec (if any)
65 $media->{host} # Host string
66 $media->{url} # Media stream URL
67 $media->{id} # Media ID
69 =head1 WWW::Quvi::Query
73 =item parse($url) [function]
75 Parse media details for URL. Returns WWW::Quvi::Media object.
77 my $m = $q->parse($url);
79 =item ($domain, $formats) next_website() [function]
81 Return next supported website (domain, formats). These values are
82 returned by the libquvi webscripts.
84 Note that C<formats> no practical use since libquvi 0.2.17. This
85 function is most useful for listing the available support.
87 Use the C<formats> function (below) instead if you need to know which
88 formats are available to an URL.
91 my ($d,$f) = $q->next_website;
92 say "$d\t$f" if $q->{ok};
95 =item formats($url) [function]
97 Returns a string containing a list of available formats to an URL. Each
98 format ID is separated by a pipe character.
100 my $fmts = $q->formats($url);
101 croak "error: $q->{errmsg}" unless $q->{ok};
102 say $_ foreach (split /\|/, $fmts);
104 =item set_opts($opts) [function]
106 Set Query options (see also L</WWW::Quvi::Options>).
108 =item supported($url) [function]
110 Returns a non-zero value if the URL is not supported.
112 This is a networkless check meaning that it will return
113 WWW::Quvi::NoSupport for most shortened (or compressed) URLs.
115 If your application must support such URLs, use Query::parse
116 instead and make sure you have not set 'resolve' to 0 (disable)
117 in your L</WWW::Quvi::Options>.
121 Non-zero if an error occurred.
123 =item errmsg [variable]
125 Last error message. Check L</ok> flag for errors.
127 croak $q->{errmsg} unless $q->{ok};
129 =item quvi_code [variable]
131 Last libquvi returned code.
133 =item resp_code [variable]
135 Last response (assumed HTTP) code returned by the server.
139 =head1 RETURN CODES (WWW::Quvi::*)
141 L</WWW::Quvi::Query> saves the last libquvi returned code as
142 C<quvi_code>. In most cases, it is sufficient to just check
143 the C<ok> and use the C<errmsg> instead.
146 Mem # Memory allocation error
147 BadHandle # Bad handle
148 InvArg # Invalid function argument
149 CurlInit # libquvi initialization failure
150 Last # Last element in the list
151 AbortedByCallBack # Aborted by a callback function
152 LuaInit # liblua initialization failure
153 NoLuaWebsite # Failed to find any libquvi webscripts
154 NoLuaUtil # Failed to find the libquvi utility scripts
155 NoSupport # libquvi cannot handle the URL
156 CallbackError # Network callback error occurred
157 IconvError # libiconv error occurred
158 LuaError # liblua (or webscript) error occurred
160 Note that L</WWW::Quvi::Query> saves the last server returned
161 B<HTTP code> as C<resp_code>. This documentation does not cover
164 =head1 PROTOCOL CATEGORIES (WWW::Quvi::*)
166 The protocol category defines which of the webscripts, that libquvi
167 provides, your application is interested in.
169 For example, if your application can handle only HTTP connections,
170 then it would make sense to set the C<category> (see
171 L</WWW::Quvi::Options>) to C<ProtoHttp>.
173 ProtoHttp # Protocol category HTTP
177 ProtoAll # Any of the above categories
179 =head1 NOT IMPLEMENTED
183 =item B<quvi_supported_ident at al>
185 =item B<Linked list interface>
187 =item B<Network interface>
189 =item B<Media segments>
197 Home : <http://www-quvi.sourceforge.net/>
198 gitweb: <http://repo.or.cz/w/www-quvi.git>
202 WWW::Quvi is free software, licensed under the LGPLv2.1+.
210 Toni Gundogdu <legatvs at sign gmail com>