Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
PerlMonks Full Size version forwarder :)

by ash (Monk)
on Mar 30, 2000 at 11:46 UTC ( #6522=sourcecode: print w/replies, xml ) Need Help??
Category: Fun/Entertainment
Author/Contact Info Ask Solem Hoel <>
Description: You hate having to load the small version of userfriendly for then to click on the link to the fullsize one? Well. This script forwards you directly to todays full size userfriendly strip :) But since userriendly doesn't update before 9 a.m in norway, i've inserted this little line: ($a[2]<9)&&$a[3]--; so that you'll be forwarded to yesterdays strip if it's not up yet. Change the 9 to your timezone :)
Replies are listed 'Best First'.
RE: Full Size version forwarder :)
by btrott (Parson) on Mar 30, 2000 at 12:26 UTC
    In the spirit of TMTOWTDI, here's another way of doing it, which only needs to make one localtime call. Of course, you also have to store around a little extra data (the months), but it's probably worth it. More descriptive variable names are always helpful too, of course. :)
    my($hour, $mday, $mon, $year) = (localtime)[2..5]; my @months = qw/jan feb mar apr may jun jul aug sep oct nov dec/; $mday-- if $hour < 9; printf "Location: +/%04d%02d%02d.html\n\n", $year%100, $months[$mon], $year+1900, $mon+1, $mday;
    (By the way: when posting code you should use the <code> tags so that your code looks, well, like code. Read more in Perl Monk Procedures.)
RE: Full Size version forwarder :)
by ishamael (Beadle) on Apr 28, 2000 at 17:43 UTC

    while i presume this will work, i shall also assume you've overlooked the fact that illiad likes to trip people up with his cataloging system for the script. by my count it has changed 4 times (maybe 3) since the start of UF, therefore, while this code does make a nasty call to lynx that could prolly be done better with lwp or something it is a bit safer, less he change it again
    $imagetag = 0; open(INFILE, "lynx -source +|"); while (<INFILE>) { next if $image; if (/.*(IMG ALT\=\"Latest Strip\" height\=219 width\=5 +76 BORDER\=0 SRC\=\"http:\/\/\/cartoons\/archives +\/.+<\/A>).*/) { $imagetag = $1; if ($imagetag =~ /.* ALT\s*=\s*"Latest Strip" +.*/i) { if ($imagetag =~ /.*(\/cartoons\/archi +ves\/.+f).*/i) { $image = $1; $image =~ s/xuf/uf/; `lynx -source http://www.userf$image > ufieimage.gif`; # i like jpgs, deal. `convert ufieimage.gif ufieima +ge.jpg`; unlink("ufieimage.gif"); } } } }

    charlie schmidt
      I see a lot of lynx downloads of the gifs. Now I understand why we're getting them. Heh.
RE: Full Size version forwarder :)
by Anonymous Monk on Aug 08, 2000 at 04:39 UTC
    Since I wrote all the UF systems, I've seen literally hundreds of these files go around. There is a quite simple and complete view of the content: wget returns an rdf file. The date param is optional, and defaults to today. The action parameter is not optional nor is the form param. There are other forms as well which change the output format. One of the output formats is "already parsed" but thats limited to our address blocks. That file format is guaranteed not to change. The one mentioned here is scheduled to be deleted. The only reason I have not done so already is because I'm lazy.... We'd of course ask that you use this for personal usage only....
      Duuh. Forgot to login.
      The material from the Anonymous Monk above was mine.
      Is there any way to "Take ownership" of a previous anon post?
      #!/usr/global/bin/perl use File::Basename; my $search_url = ' +rdf\&action=search'; my $comics_dir = '/home/user/.comics/'; my $url; open(IN, "wget -q -O - $search_url |") or die $!; while (<IN>) { if (/Today\'s Strip/) { <IN> =~ m|<link>(.*)</link>|; $url = $1; break; } } my $gif = $comics_dir . basename($url); system("wget -q -O $gif $url"); system("xv $gif");
        #!/usr/global/bin/perl -w use File::Basename; my $search_url = ' +rdf\&action=search'; my $comics_dir = '/home/user/.comics/'; open(IN, "wget -q -O - $search_url |") or die $!; while (<IN>) { last if /Today\'s Strip/; } <IN> =~ m|<link>(.*)</link>|; my $gif = $comics_dir . basename($1); system("wget -q -O $gif $1"); system("xv $gif");
Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://6522]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2020-09-19 00:43 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (114 votes). Check out past polls.