StreamFinder/Tunein.pm untested

filter: Statementstmt 0.0% 0 / 159 Branchbran 0.0% 0 / 132 Conditioncond 0.0% 0 / 33 MC/DCmcdc 0.0% 0 / 22 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 354 CC 67 SCAR 83.4
CC
67
Cov
0%
new
4556.0
BEGIN
2.0
BEGIN
2.0
CRAP 4181.7
1 =head1 NAME
2  
3 StreamFinder::Tunein - Fetch actual raw streamable URLs from radio-station websites on Tunein.com
4  
5 =head1 AUTHOR
6  
7 This module is Copyright (C) 2021-2026 by
8  
9 Jim Turner, C<< <turnerjw784 at yahoo.com> >>
10
11 Email: turnerjw784@yahoo.com
12  
13 All rights reserved.
14  
15 You may distribute this module under the terms of either the GNU General
16 Public License or the Artistic License, as specified in the Perl README
17 file.
18  
19 =head1 SYNOPSIS
20  
21 #!/usr/bin/perl
22  
23 use strict;
24  
25 use StreamFinder::Tunein;
26  
27 die "..usage: $0 ID|ID/ID|URL\n" unless ($ARGV[0]);
28  
29 my $station = new StreamFinder::Tunein($ARGV[0]);
30  
31 die "Invalid URL or no streams found!\n" unless ($station);
32  
33 my @streams = $station->get();
34  
35 my $url = $station->getURL();
36  
37 print "Stream URL=$url\n";
38  
39 my $stationTitle = $station->getTitle();
40
41 print "Title=$stationTitle\n";
42
43 my $stationDescription = $station->getTitle('desc');
44
45 print "Description=$stationDescription\n";
46
47 my $stationID = $station->getID();
48  
49 print "Station ID=$stationID\n";
50
51 my $genre = $station->{'genre'};
52  
53 print "Genre=$genre\n" if ($genre);
54
55 my $artist = $station->{'artist'};
56  
57 print "Artist=$artist\n" if ($artist);
58
59 my $album = $video->{'album'};
60  
61 print "Album (podcast)=$album\n" if ($album);
62
63 my $albumartist = $video->{'albumartist'};
64  
65 print "Album Artist=$albumartist\n" if ($albumartist);
66
67 my $icon_url = $station->getIconURL();
68  
69 if ($icon_url) { #SAVE THE ICON TO A TEMP. FILE:
70  
71 my ($image_ext, $icon_image) = $station->getIconData();
72  
73 if ($icon_image && open IMGOUT, ">/tmp/${stationID}.$image_ext") {
74  
75 binmode IMGOUT;
76  
77 print IMGOUT $icon_image;
78  
79 close IMGOUT;
80  
81 }
82  
83 }
84  
85 my $stream_count = $station->count();
86  
87 print "--Stream count=$stream_count=\n";
88  
89 my @streams = $station->get();
90  
91 foreach my $s (@streams) {
92  
93 print "------ stream URL=$s=\n";
94  
95 }
96  
97 =head1 DESCRIPTION
98  
99 StreamFinder::Tunein accepts a valid radio station or podcast ID or URL on
100 Tunein.com and returns the actual stream URL(s), title, and cover art icon.
101 The purpose is that one needs one of these URLs in order to have the option to
102 stream the station in one's own choice of media player software rather than
103 using their web browser and accepting any / all flash, ads, javascript,
104 cookies, trackers, web-bugs, and other crapware that can come with that method
105 of play. The author uses his own custom all-purpose media player called
106 "fauxdacious" (his custom hacked version of the open-source "audacious"
107 audio player). "fauxdacious" can incorporate this module to decode and play
108 Tunein.com streams. One or more streams can be returned for each station.
109  
110 Depends:
111  
112 L<URI::Escape>, L<HTML::Entities>, L<LWP::UserAgent>
113  
114 =head1 SUBROUTINES/METHODS
115  
116 =over 4
117  
118 =item B<new>(I<ID>|I<ID/ID>|I<url> [, I<-notrim> [ => 0|1 ]]
119 [, I<-formats> => "type1,type2?..." | [type1,type2?...] ]
120 [, I<-secure> [ => 0|1 ]] [, I<-debug> [ => 0|1|2 ]])
121  
122 Accepts a tunein.com station / podcast ID or URL and creates and returns a new
123 station object, or I<undef> if the URL is not a valid Tunein station or podcast,
124 or no streams are found. The URL can be the full URL,
125 ie. https://tunein.com/radio/B<station-id>,
126 https://tunein.com/podcasts/B<podcast-id>/?topicId=B<episode-id>,
127 or just I<station-id> or I<podcast-id>/I<episode-id>. NOTE: For podcasts,
128 you must also include the I<episode-id>, otherwise, the I<podcast-id> will be
129 interpreted as a I<station-id> and you'll likely get no streams!
130  
131 The optional I<-notrim> argument can be either 0 or 1 (I<false> or I<true>).
132 If 0 (I<false>) then stream URLs are trimmed of excess "ad" parameters
133 (everything after the first "?" character, ie. "?ads.cust_params=premium" is
134 removed, including the "?". Otherwise, the stream URLs are returned as-is.
135  
136 DEFAULT I<-notrim> (if not given) is 0 (I<false>) and URLs are trimmed. If
137 I<-notrim> is specified without argument, the default is 1 (I<true>). Try
138 using I<-notrim> if stream will not play without the extra arguments.
139  
140 The optional I<-formats> argument can be either a comma-separated string or an
141 array reference ([...]) of stream types to keep (include) and returned in
142 order specified (type1, type2...). Each "type" can be an extension
143 (ie. mp3, acc, pls, etc.), or ("any" or "all" to keep all formats).
144  
145 DEFAULT I<-formats> list is: 'all', meaning that all streams are accepted.
146  
147 NOTE: I<-formats> only applies to streaming stations and is ignored for podcasts.
148  
149 The optional I<-secure> argument can be either 0 or 1 (I<false> or I<true>).
150 If 1 then only secure ("https://") streams will be returned.
151  
152 DEFAULT I<-secure> is 0 (false) - return all streams (http and https).
153  
154 WARNING!: As of the latest StreamFinder release, almost ALL Tunein radio
155 station streams are "insecure" (http)!
156  
157 Additional options:
158  
159 I<-log> => "I<logfile>"
160  
161 Specify path to a log file. If a valid and writable file is specified, A line
162 will be appended to this file every time one or more streams is successfully
163 fetched for a url.
164  
165 DEFAULT I<-none-> (no logging).
166  
167 I<-logfmt> specifies a format string for lines written to the log file.
168  
169 DEFAULT "I<[time] [url] - [site]: [title] ([total])>".
170  
171 The valid field I<[variables]> are: [stream]: The url of the first/best
172 stream found. [site]: The site name (Tunein). [url]: The url searched
173 for streams. [time]: Perl timestamp when the line was logged. [title],
174 [artist], [album], [description], [year], [genre], [total], [albumartist]:
175 The corresponding field data returned (or "I<-na->", if no value).
176  
177 =item $station->B<get>()
178  
179 Returns an array of strings representing all stream URLs found.
180  
181 =item $station->B<getURL>([I<options>])
182  
183 Similar to B<get>() except it only returns a single stream representing
184 the first valid stream found.
185  
186 Current options are: I<"random">, I<"nopls">, and I<"noplaylists">.
187 By default, the first ("best"?) stream is returned. If I<"random"> is
188 specified, then a random one is selected from the list of streams found.
189 If I<"nopls"> is specified, and the stream to be returned is a ".pls" playlist,
190 it is first fetched and the first entry (or a random entry if I<"random"> is
191 specified) is returned. This is needed by Fauxdacious Mediaplayer.
192 If I<"noplaylists"> is specified, and the stream to be returned is a
193 "playlist" (either .pls or .m3u? extension), it is first fetched and the first
194 entry (or a random entry if I<"random"> is specified) in the playlist
195 is returned.
196  
197 =item $station->B<count>()
198  
199 Returns the number of streams found for the station.
200  
201 =item $station->B<getID>(['fccid'])
202  
203 Returns the station's Tunein ID (default) or
204 station's FCC call-letters ("fccid").
205  
206 =item $station->B<getTitle>(['desc'])
207  
208 Returns the station's title, or (long description).
209  
210 =item $station->B<getIconURL>()
211  
212 Returns the URL for the station's "cover art" icon image, if any.
213  
214 =item $station->B<getIconData>()
215  
216 Returns a two-element array consisting of the extension (ie. "png",
217 "gif", "jpeg", etc.) and the actual icon image (binary data), if any.
218  
219 =item $station->B<getImageURL>()
220  
221 Returns the URL for the station's "cover art" (usually larger)
222 banner image, if any.
223  
224 =item $station->B<getImageData>()
225  
226 Returns a two-element array consisting of the extension (ie. "png",
227 "gif", "jpeg", etc.) and the actual station's banner image (binary data).
228  
229 =item $station->B<getType>()
230  
231 Returns the station's type ("Tunein").
232  
233 =back
234  
235 =head1 CONFIGURATION FILES
236  
237 The default root location directory for StreamFinder configuration files
238 is "~/.config/StreamFinder". To use an alternate location directory,
239 specify it in the "I<STREAMFINDER>" environment variable, ie.:
240 B<$ENV{STREAMFINDER} = "/etc/StreamFinder">.
241  
242 =over 4
243  
244 =item ~/.config/StreamFinder/Tunein/config
245  
246 Optional text file for specifying various configuration options
247 for a specific site (submodule). Each option is specified on a
248 separate line in the format below:
249 NOTE: Do not follow the lines with a semicolon, comma, or any other
250 separator. Non-numeric I<values> should be surrounded with quotes, either
251 single or double. Blank lines and lines beginning with a "#" sign as
252 their first non-blank character are ignored as comments.
253  
254 'option' => 'value' [,]
255  
256 and the options are loaded into a hash used only by the specific
257 (submodule) specified. Valid options include
258 I<-debug> => [0|1|2] and most of the L<LWP::UserAgent> options.
259  
260 Options specified here override any specified in I<~/.config/StreamFinder/config>.
261  
262 Among options valid for Tunein streams is the I<-notrim> described in the
263 B<new()> function.
264  
265 =item ~/.config/StreamFinder/config
266  
267 Optional text file for specifying various configuration options.
268 Each option is specified on a separate line in the format below:
269  
270 'option' => 'value' [,]
271  
272 and the options are loaded into a hash used by all sites
273 (submodules) that support them. Valid options include
274 I<-debug> => [0|1|2] and most of the L<LWP::UserAgent> options.
275  
276 =back
277  
278 NOTE: Options specified in the options parameter list of the I<new()>
279 function will override those corresponding options specified in these files.
280  
281 =head1 KEYWORDS
282  
283 tunein
284  
285 =head1 DEPENDENCIES
286  
287 L<URI::Escape>, L<HTML::Entities>, L<LWP::UserAgent>
288  
289 =head1 RECCOMENDS
290  
291 wget
292  
293 =head1 BUGS
294  
295 Please report any bugs or feature requests to C<bug-streamFinder-tunein at rt.cpan.org>, or through
296 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=StreamFinder-Tunein>. I will be notified, and then you'll
297 automatically be notified of progress on your bug as I make changes.
298  
299 =head1 SUPPORT
300  
301 You can find documentation for this module with the perldoc command.
302  
303 perldoc StreamFinder::Tunein
304  
305 You can also look for information at:
306  
307 =over 4
308  
309 =item * RT: CPAN's request tracker (report bugs here)
310  
311 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=StreamFinder-Tunein>
312  
313 =item * AnnoCPAN: Annotated CPAN documentation
314  
315 L<http://annocpan.org/dist/StreamFinder-Tunein>
316  
317 =item * Search CPAN
318  
319 L<http://search.cpan.org/dist/StreamFinder-Tunein/>
320  
321 =back
322  
323 =head1 LICENSE AND COPYRIGHT
324  
325 Copyright 2021-2026 Jim Turner.
326  
327 This program is free software; you can redistribute it and/or modify it
328 under the terms of the the Artistic License (2.0). You may obtain a
329 copy of the full license at:
330  
331 L<http://www.perlfoundation.org/artistic_license_2_0>
332  
333 Any use, modification, and distribution of the Standard or Modified
334 Versions is governed by this Artistic License. By using, modifying or
335 distributing the Package, you accept this license. Do not use, modify,
336 or distribute the Package, if you do not accept this license.
337  
338 If your Modified Version has been derived from a Modified Version made
339 by someone other than you, you are nevertheless required to ensure that
340 your Modified Version complies with the requirements of this license.
341  
342 This license does not grant you the right to use any trademark, service
343 mark, tradename, or logo of the Copyright Holder.
344  
345 This license includes the non-exclusive, worldwide, free-of-charge
346 patent license to make, have made, use, offer to sell, sell, import and
347 otherwise transfer the Package with respect to any patent claims
348 licensable by the Copyright Holder that are necessarily infringed by the
349 Package. If you institute patent litigation (including a cross-claim or
350 counterclaim) against any party alleging that the Package constitutes
351 direct or contributory patent infringement, then this Artistic License
352 to you shall terminate on the date that such litigation is filed.
353  
354 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
355 AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
356 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
357 PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
358 YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
359 CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
360 CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
361 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
362  
363 =cut
364  
365 package StreamFinder::Tunein;
366  
367 use strict;
368 use warnings;
369 use URI::Escape;
370 use HTML::Entities ();
371 use LWP::UserAgent ();
372 use parent 'StreamFinder::_Class';
373  
374 my $DEBUG = 0;
375  
376 sub new
377 {
378 my $class = shift;
379 my $url = shift;
380  
381 return undef unless ($url);
382  
383 my $self = $class->SUPER::new('Tunein', @_);
384 $DEBUG = $self->{'debug'} if (defined $self->{'debug'});
385  
386 my $okStreams;
387 $self->{'notrim'} = 0;
388 while (@_) {
389 if ($_[0] =~ /^\-?formats$/o) {
390 shift;
391 if (defined $_[0]) {
392 my $keeporder = shift;
393 $okStreams = (ref($keeporder) =~ /ARRAY/) ? join(',',@{$keeporder}) : $keeporder;
394 }
395 } elsif ($_[0] =~ /^\-?notrim$/o) {
396 shift;
397 $self->{'notrim'} = (defined $_[0]) ? shift : 1;
398 } else {
399 shift;
400 }
401 }
402 $okStreams = 'all' unless ($okStreams);
403  
404 my $html = '';
405 print STDERR "-0(Tunein): URL=$url=\n" if ($DEBUG);
406 my $ua = LWP::UserAgent->new(@{$self->{'_userAgentOps'}});
407 $ua->timeout($self->{'timeout'});
408 $ua->cookie_jar({});
409 $ua->env_proxy;
410  
411 (my $url2fetch = $url);
412  
413 my $tried = 0;
414 TRYIT:
415 #DEPRECIATED (STATION-IDS NOW INCLUDE STUFF BEFORE THE DASH: ($self->{'id'} = $url) =~ s#^.*\-([a-z]\d+)\/?$#$1#;
416 if ($url2fetch =~ m#^https?\:#) {
417 ($self->{'id'} = $url) =~ s#^.*?\/([a-zA-Z0-9\-\_]+)(?:\/?|\/\?[^\/]+\/?)$#$1#;
418 } else {
419 my ($id, $podcastid) = split(m#\/#, $url2fetch);
420 $self->{'id'} = $id;
421 $url2fetch = ($podcastid ? 'https://tunein.com/podcasts/' : 'https://tunein.com/radio/'). $id;
422 $url2fetch .= '/?topicId=' . $podcastid if ($podcastid);
423 }
424 print STDERR "-1 (try=$tried) FETCHING URL=$url2fetch=\n" if ($DEBUG);
425 my $response = $ua->get($url2fetch);
426 if ($response->is_success) {
427 $html = $response->decoded_content;
428 } else {
429 print STDERR $response->status_line if ($DEBUG);
430 my $no_wget = system('wget','-V');
431 unless ($no_wget) {
432 print STDERR "\n..trying wget...\n" if ($DEBUG);
433 $html = `wget -t 2 -T 20 -O- -o /dev/null "$url2fetch" 2>/dev/null `;
434 }
435 }
436 print STDERR "-1: html=$html=\n" if ($DEBUG > 1);
437 $html =~ s/\\\"/\&quot\;/gs;
438 if ($html) { #EXTRACT METADATA, IF WE CAN:
439 print STDERR "-1: EXTRACTING METADATA...\n" if ($DEBUG);
440 $self->{'id'} = $1 if ($html =~ m#\"guideId\"\:\"([^\"]+)\"#);
441 $self->{'fccid'} = ($html =~ m#\"callSign\"\:\"([^\"]+)\"#i) ? $1 : '';
442 $self->{'title'} = ($html =~ m#\"twitter\:title\"\s+content\=\"([^\"]+)\"#) ? $1 : '';
443 $self->{'album'} ||= ($html =~ m#\<h1\s+data\-testid\=\"profileTitle\"\s+title\=\"([^\"]+)\"#) ? $1 : '';
444 if ($self->{'title'} !~ /\S/) {
445 $self->{'title'} = $self->{'album'};
446 $self->{'album'} = '';
447 }
448 $self->{'artist'} = ($html =~ m#\"profileSubtitle\"\>([^\<]+)#) ? $1 : '';
449 if ($html =~ m#\<div\s+class\=\"pageTitles\_+description\_+[^\"]+\"\>(.+?)\<\/div\>#s) {
450 $self->{'description'} = $1;
451 }
452 $self->{'description'} ||= $1 if ($html =~ m#name\=\"twitter\:description\"\s+content\=\"([^\"]+)\"#i);
453 $self->{'iconurl'} = ($html =~ m#\"twitter\:image\:src\"\s+content\=\"([^\"]+)\"#) ? $1 : '';
454 $self->{'iconurl'} ||= ($html =~ m#\"image\"\:\"([^\"]+)\"#) ? $1 : '';
455 $self->{'iconurl'} =~ s#\\u002F#\/#g;
456 $self->{'iconurl'} =~ s#\?.+$##;
457 $self->{'imageurl'} = ($html =~ m#\"bannerImage\"\:\"([^\"]+)\"#) ? $1 : $self->{'iconurl'};
458 $self->{'imageurl'} =~ s#\\u002F#\/#g;
459 $self->{'imageurl'} =~ s#\?.+$##;
460 if ($self->{'artist'} =~ /\S/) {
461 $self->{'artist'} =~ s/\s*\\?u?003E\s*$//;
462 $self->{'artist'} = HTML::Entities::decode_entities($self->{'artist'});
463 $self->{'artist'} = uri_unescape($self->{'artist'});
464 }
465 my $genre = ($html =~ m#\"rootGenre\"\:\"([^\"]+)\"#) ? $1 : '';
466 my $subgenre = ($html =~ m#\"primaryGenreName\"\:\"([^\"]+)\"#) ? $1 : '';
467 if ($genre && $subgenre) {
468 #$self->{'genre'} = ($genre eq 'music') ? $subgenre : $genre . ' - ' . $subgenre;
469 $self->{'genre'} = ($genre =~ /music/i) ? $subgenre : $genre;
470 } elsif ($genre) {
471 $self->{'genre'} = $genre;
472 } elsif ($subgenre) {
473 $self->{'genre'} = $subgenre;
474 }
475 if ($self->{'genre'}) {
476 $self->{'genre'} =~ s/\s*\\?u?003E\s*$//;
477 $self->{'genre'} = HTML::Entities::decode_entities($self->{'genre'});
478 $self->{'genre'} = uri_unescape($self->{'genre'});
479 }
480 }
481 return undef unless ($self->{'id'});
482  
483 my $stationID = $self->{'id'};
484 while ($html =~ s#\"playUrl\"\:\"([^\"]+)\"#STREAMFINDER_MARK#i) { #PROBABLY A PODCAST?:
485 (my $one = $1) =~ s#\\u002F#\/#g;
486 $one =~ s/\b(mp3|m3u8|pls)\?.*$/$1/ unless ($self->{'notrim'}); #STRIP OFF EXTRA GARBAGE PARMS, COMMENT OUT IF STARTS FAILING!
487 unless ($self->{'secure'} && $one !~ /^https/o) {
488 push @{$self->{'streams'}}, $one;
489 $self->{'cnt'}++;
490 }
491 print STDERR "i:Found stream ($one) in page.\n" if ($DEBUG);
492 }
493 if ($self->{'cnt'}) { #STREAM(S) FOUND, PBLY. A PODCAST (EPISODE):
494 $self->{'id'} .= '/' . $1 if ($html =~ s#\"guideId\"\:\"([^\"]+)\"\,STREAMFINDER_MARK#STREAMFINDER_MARK#i);
495 $self->{'created'} = $1 if ($html =~ s#\"publishTime\"\:\"([^\"]*)\"\,STREAMFINDER_MARK##i);
496 $self->{'year'} = (defined($self->{'created'}) && $self->{'created'} =~ /(\d\d\d\d)/) ? $1 : '';
497 print STDERR "i:Podcast found, ID changed to (".$self->{'id'}."), year (".$self->{'year'}.").\n" if ($DEBUG);
498 } elsif ($html =~ m#\bhref\=\".+?\/\?topicId\=([^\"]+)#) { #NO STREAMS FOUND, BUT WE'RE A PODCAST (PAGE):
499 $url2fetch = 'https://tunein.com/podcasts/'.$self->{'id'}.'/?topicId=' . $1;
500 print STDERR "--RETRY (PODCAST PAGE) 1ST EPISODE URL=$url2fetch=\n" if ($DEBUG);
501 ++$tried;
502 goto TRYIT;
503 } elsif (!$tried) { #(USUALLY) NO STREAMS / PODCASTS EPISODES FOUND (PBLY. A STATION):
504 #SEE: https://stackoverflow.com/questions/52754263/playing-a-live-tunein-radio-url-ios-swift
505 #ALSO: https://github.com/core-hacked/tunein-api/commit/a1bebe327f46cdaab0f1306741546438020584b9
506 my $tryStream = "https://opml.radiotime.com/Tune.ashx?id=$stationID&render=json";
507 print STDERR "-2 (we're a station) FETCHING URL=$tryStream=\n" if ($DEBUG);
508 my $response = $ua->get($tryStream);
509 if ($response->is_success) {
510 $html = $response->decoded_content;
511 } else {
512 print STDERR $response->status_line if ($DEBUG);
513 my $no_wget = system('wget','-V');
514 unless ($no_wget) {
515 print STDERR "\n..trying wget...\n" if ($DEBUG);
516 $html = `wget -t 2 -T 20 -O- -o /dev/null "$url2fetch" 2>/dev/null `;
517 }
518 }
519  
520 if ($html) {
521 print STDERR "-2a opml.radiotime.com returned HTML==>$html<==\n" if ($DEBUG > 1);
522 while ($html =~ s#\"url\"\:\s*\"([^\"]+)\"##so) {
523 my $stream = $1;
524 $stream =~ s/\b(mp3|m3u8|pls)\?.*$/$1/ unless ($self->{'notrim'});
525 unless ($self->{'secure'} && $stream !~ /^https/o) {
526 my $ext = $1 if ($stream =~ m#\.(\w+)#);
527 if ($okStreams =~ m#(?:any|all)#io || (defined($ext) && $okStreams =~ m#$ext#i)) {
528 print STDERR "---ADDING STREAM=$stream=\n" if ($DEBUG);
529 push @{$self->{'streams'}}, $stream;
530 $self->{'cnt'}++;
531 }
532 }
533 }
534 }
535 $self->{'album'} = $self->{'artist'};
536 $self->{'artist'} = ''; #ONLY PODCASTS HAVE ARTISTS, NOT STATIONS!
537 }
538 $self->{'total'} = $self->{'cnt'};
539 $self->{'title'} = HTML::Entities::decode_entities($self->{'title'});
540 $self->{'title'} = uri_unescape($self->{'title'});
541 $self->{'description'} ||= $self->{'title'};
542 $self->{'description'} = HTML::Entities::decode_entities($self->{'description'});
543 $self->{'description'} = uri_unescape($self->{'description'});
544 $self->{'Url'} = ($self->{'total'} > 0) ? $self->{'streams'}->[0] : '';
545 if ($DEBUG) {
546 foreach my $i (sort keys %{$self}) {
547 print STDERR "--KEY=$i= VAL=".$self->{$i}."=\n";
548 }
549 }
550 print STDERR "--SUCCESS: 1st stream=".$self->{'Url'}."= total=".$self->{'total'}."=\n"
551 if ($DEBUG && $self->{'cnt'} > 0);
552 $self->_log($url);
553  
554 bless $self, $class; #BLESS IT!
555  
556 return $self;
557 }
558  
559 1