StreamFinder

 view release on metacpan or  search on metacpan

lib/StreamFinder/PragerU.pm  view on Meta::CPAN


		}

	}

	my $stream_count = $video->count();

	print "--Stream count=$stream_count=\n";

	my @streams = $video->get();

	foreach my $s (@streams) {

		print "------ stream URL=$s=\n";

	}

=head1 DESCRIPTION

StreamFinder::PragerU accepts a valid video ID or URL on 
www.prageru.com and returns the actual stream URL(s), title, and cover 
art icon.  The purpose is that one needs one of these URLs in order to have 
the option to stream the video in one's own choice of media player software 
rather than using their web browser and accepting any / all flash, ads, 
javascript, cookies, trackers, web-bugs, and other crapware that can come with 
that method of play.  The author uses his own custom all-purpose media player 
called "fauxdacious" (his custom hacked version of the open-source "audacious" 
audio player).  "fauxdacious" can incorporate this module to decode and play 
www.prageru.com streams.

One stream URL can be returned for each video.

=head1 SUBROUTINES/METHODS

=over 4

=item B<new>(I<ID>|I<url> [, I<-secure> [ => 0|1 ]] [, I<-debug> [ => 0|1|2 ]])

Accepts a www.prageru.com video ID or URL and creates and 
returns a a new video object, or I<undef> if the URL is not a valid video, or 
no streams are found.  The URL can be the full URL, ie. 
https://www.prageru.com/videos/video-id>, or just 
B<video-id>.

The optional I<-keep> argument can be either a comma-separated string or an 
array reference ([...]) of stream types (extensions) to keep (include) and 
returned in order specified (type1, type2...).  Each "type" (extension) can be 
one of:  "mp3", "m4a", "mp4", "pls" (playlist), etc.  NOTE:  Since these are 
actual extensions used to identify streams, there is NO 
"any/all/stream/playlist" catch-all options as used by some of the other 
(more specific) StreamFinder-supported sites!  Streams will be returned sorted 
by extension in the order specified in this list.

DEFAULT I<-keep> list is:  "m3u8,mp4,m4a,mpd,mp3,ogg,flac,aac", meaning 
that all m3u8 (hls) streams found (if any), followed by all "ogg" streams, etc.

NOTE:  Most PragerU videos are now in .m3u8 (hls) format!

The optional I<-secure> argument can be either 0 or 1 (I<false> or I<true>).  
If 1 then only secure ("https://") streams will be returned.  Currently, 
all PragerU streaming URLs are believed to be secure (https).

DEFAULT I<-secure> is 0 (false) - return all streams (http and https).

Additional options:

I<-log> => "I<logfile>"

Specify path to a log file.  If a valid and writable file is specified, A line 
will be appended to this file every time one or more streams is successfully 
fetched for a url.

DEFAULT I<-none-> (no logging).

I<-logfmt> specifies a format string for lines written to the log file.

DEFAULT "I<[time] [url] - [site]: [title] ([total])>".  

The valid field I<[variables]> are:  [stream]: The url of the first/best 
stream found.  
[site]:  The site name (PragerU).  [url]:  The url searched for streams.  
[time]: Perl timestamp when the line was logged.  [title], [artist], [album], 
[description], [year], [genre], [total], [albumartist]:  The corresponding 
field data returned (or "I<-na->", if no value).

=item $video->B<get>(['playlist'])

Playlists are not currently supported.

=item $video->B<getURL>([I<options>])

Similar to B<get>() except it only returns a single stream representing 
the first valid stream found.  There currently are no valid I<options>.

=item $video->B<count>()

Returns the number of streams found for the video (will nearly always be 1).

=item $video->B<getID>()

Returns the video's PragerU ID (default).  PragerU video IDs 
consist of combinations of lower-case letters, numbers and hyphens.

=item $video->B<getTitle>(['desc'])

Returns the video's title, or (long description).  Videos 
on PragerU can have separate descriptions, but for videos, 
it is always the video's title.

Note:  PragerU video descriptions are usually incomplete, ending with a "..", 
since on the page itself there's a "Read More" button to view the rest, and 
"the rest" can only be obtained with Javascript.

=item $video->B<getIconURL>(['artist'])

Returns the URL for the video's "cover art" icon image, if any.
If B<'artist'> is specified, the channel artist's icon url is returned, 
if any.

=item $video->B<getIconData>(['artist'])



( run in 0.544 second using v1.01-cache-2.11-cpan-39bf76dae61 )