CrossFit Discussion Board  

Go Back   CrossFit Discussion Board > Community > Community
CrossFit Home Forum Site Rules CrossFit FAQ Search Today's Posts Mark Forums Read

Community Catch all category for CrossFit community discussion.

Reply
 
Thread Tools
Old 07-11-2005, 02:24 AM   #1
Christian Lemburg
Member Christian Lemburg is offline
 
Profile:
Join Date: Jan 2005
Location: Aachen  NRW
Posts: 308
Hi folks,

this little Perl script grabs the WOD from the CrossFit main page and sends it to you by email via SMTP.

All you need to do is to copy and paste the text between the CDATA section markers below into a file named get-wod.pl, save the script to some folder, edit the username for to/from (do not delete the \ before the @ sign!) and the server name, and create a new task to run at the desired time that executes the script. Voila, WOD per email. (You obviously need to have Perl installed on your computer for this to work, but I won't go into detail on that here.)

[code]
<![CDATA[


#!/usr/bin/perl -w
use strict;

use POSIX;
use LWP::Simple;
use Text::Wrap;
use Net::SMTP;


my $d = strftime qq(%y%m%d), localtime;
my $s = "";
($s = $1.qq(\n).$2) =~ s/<[^>]*>//g if get(qq(http://www.crossfit.com/)) =~ /($d)(.*?)<img/smi;
my $text = fill(q(),q(), $s);

my $mail = "user\@mydomain.com";
my $smtp = Net::SMTP->new('mail.mydomain.com');
$smtp->mail($mail);
$smtp->to($mail);
$smtp->data();
$smtp->datasend("To: $mail\nSubject: WOD - $d\n");
$smtp->datasend("\n");
$smtp->datasend($text);
$smtp->dataend();
$smtp->quit;


]]>
[/code]
  Reply With Quote
Old 07-11-2005, 02:33 AM   #2
David Easton
Member David Easton is offline
 
David Easton's Avatar
 
Profile:
Join Date: Dec 2004
Location: Motherwell  Strathclyde
Posts: 566
you lost me at -

"this little Perl script..."!!!

  Reply With Quote
Old 07-11-2005, 03:06 AM   #3
Chuck Pelowski
Member Chuck Pelowski is offline
 
Profile:
Join Date: Feb 2005
Location: Lubbock  TX
Posts: 88
Handy little scraper. Thanks.
  Reply With Quote
Old 07-11-2005, 04:30 AM   #4
Karl Steadman
Member Karl Steadman is offline
 
Profile:
Join Date: Feb 2005
Location: Glossop  Derbyshire
Posts: 598
huh....:uhoh::sad:
  Reply With Quote
Old 07-11-2005, 06:29 AM   #5
Tanner Kolb
Member Tanner Kolb is offline
 
Profile:
Join Date: Jan 2008
Location: Petoskey  MI
Posts: 265
way to much for my little brain to understand. anyway, if i can check my e-mail i can look at the WOD.
  Reply With Quote
Old 07-11-2005, 08:06 AM   #6
Jonathan Kessler
Member Jonathan Kessler is offline
 
Profile:
Join Date: Aug 2004
Location: Boulder Creek  CA
Posts: 251
Guys,
Whether or not you're nerd enough to appreciate it, consider this the geek equivalent of a muscle-up.
Christian, nice work!
JK
  Reply With Quote
Old 07-11-2005, 02:19 PM   #7
Chuck Pelowski
Member Chuck Pelowski is offline
 
Profile:
Join Date: Feb 2005
Location: Lubbock  TX
Posts: 88
Chrisitan -

Mind if I port this over with perl2exe and upload it here? It might help some of these folks.
  Reply With Quote
Old 07-11-2005, 11:29 PM   #8
Laura Rucker
Member Laura Rucker is offline
 
Profile:
Join Date: Sep 2004
Location: San Diego  CA
Posts: 845
Sweet!

if i can check my e-mail i can look at the WOD.

Hey, Tanner! Practical application: have the script send it to your cell phone so you get it when you are away from the computer!

Chuck, an exe would be AWESOME. I love me some computer geeks with muscles! :biggrin:
  Reply With Quote
Old 07-12-2005, 12:46 AM   #9
Christian Lemburg
Member Christian Lemburg is offline
 
Profile:
Join Date: Jan 2005
Location: Aachen  NRW
Posts: 308
No, of course I don't mind at all. Do with it whatever you want, it was the result of some spare minutes when I was bored. Obviously you will have to put the username and server into some property file or such (maybe question for it on first use and store it?). The main insight in the code is that to grab the WOD, you want the part between the short ISO date of today and the opening tag of the image below the text. That's all.

Cheers,

Christian
  Reply With Quote
Old 07-12-2005, 06:26 AM   #10
Scott Kustes
Member Scott Kustes is offline
 
Scott Kustes's Avatar
 
Profile:
Join Date: Jun 2003
Location: Louisville  KY
Posts: 1,258
Purrrrrrr.....talk nerdy to me!
  Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
From a Spam Email "Only in America" Paul Findley Community 1 05-06-2006 10:52 AM
Funny email from one of my clients... Michael Latch Community 5 04-04-2006 04:38 PM
Got any Qs about KBs and/or CrossFit? Please email Tom Corrigan Community 0 07-26-2005 08:00 PM


All times are GMT -7. The time now is 10:30 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
CrossFit is a registered trademark of CrossFit Inc.