Forum: Ruby download a comic strip and email to myself with Ruby?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eb71c362ddeda80c2668d2575e97bc70?d=identicon&s=25 winter heat (winterheat)
on 2009-05-26 10:54
using Ruby on my local Windows machine, can I easily write a script to
download a comic strip every day and email it to myself?

such as
http://comics.com/peanuts
5772c599ccab3081e0fffb1d54f3b6de?d=identicon&s=25 Andrew Timberlake (andrewtimberlake)
on 2009-05-26 11:04
(Received via mailing list)
On Tue, May 26, 2009 at 10:54 AM, SpringFlowers AutumnMoon
<blueskybreeze@gmail.com> wrote:
> using Ruby on my local Windows machine, can I easily write a script to
> download a comic strip every day and email it to myself?
>
> such as
> http://comics.com/peanuts

Yes

Andrew Timberlake
http://ramblingsonrails.com

http://MyMvelope.com - The SIMPLE way to manage your savings
Eb71c362ddeda80c2668d2575e97bc70?d=identicon&s=25 winter heat (winterheat)
on 2009-05-26 20:44
Andrew Timberlake wrote:
> On Tue, May 26, 2009 at 10:54 AM, SpringFlowers AutumnMoon
> <blueskybreeze@gmail.com> wrote:
>> using Ruby on my local Windows machine, can I easily write a script to
>> download a comic strip every day and email it to myself?
>>
>> such as
>> http://comics.com/peanuts
>
> Yes

how is it done?
08995c0e987a0b6d452a791369f96370?d=identicon&s=25 Alex (Guest)
on 2009-05-26 20:58
(Received via mailing list)
I would use Hpricot to parse the HTML and get the image, then any of the
Ruby email libraries to send it to yourself. It's really a trivial
problem,
but if you're having specific issues, I'm sure many of the people on
this
list would be willing to help.

Alex
5772c599ccab3081e0fffb1d54f3b6de?d=identicon&s=25 Andrew Timberlake (andrewtimberlake)
on 2009-05-26 21:12
(Received via mailing list)
On Tue, May 26, 2009 at 8:57 PM, Alex <imphasing@gmail.com> wrote:
> I would use Hpricot to parse the HTML and get the image, then any of the
> Ruby email libraries to send it to yourself. It's really a trivial problem,
> but if you're having specific issues, I'm sure many of the people on this
> list would be willing to help.
>
> Alex
>

Even easier, find out how the images are named because they are often
named yyyymmdd.jpg or similar and then just try and pull the image for
the day in question.
404 - no image
200 - you've got it

Andrew Timberlake
http://ramblingsonrails.com

http://MyMvelope.com - The SIMPLE way to manage your savings
Eb71c362ddeda80c2668d2575e97bc70?d=identicon&s=25 winter heat (winterheat)
on 2009-05-26 21:15
Alex wrote:
> I would use Hpricot to parse the HTML and get the image, then any of the
> Ruby email libraries to send it to yourself. It's really a trivial
> problem,
> but if you're having specific issues, I'm sure many of the people on
> this
> list would be willing to help.

is it true that we just use the smtp.my-isp.com to send it?  is there
any other way?
Da33a4ac652c1c8900392a8599206640?d=identicon&s=25 Thomas B. (tpreal)
on 2009-05-26 21:30
Jian Lin wrote:
> using Ruby on my local Windows machine, can I easily write a script to
> download a comic strip every day and email it to myself?
>
> such as
> http://comics.com/peanuts

As for downloading a file:
http://al2o3-cr.blogspot.com/2008/08/downloading-file.html
08995c0e987a0b6d452a791369f96370?d=identicon&s=25 Alex (Guest)
on 2009-05-26 21:56
(Received via mailing list)
You can use any SMTP server to email the images. I would just use
Net::SMTP
with whatever SMTP server you happen to be using. It's true that some
ISPs
offer SMTP servers, but smtp.<your_isp>.com may not be the naming
convention
that your ISP uses.

Remember, you're going to need to attach the image to the email as well,
so
you'll need to create a multipart message, with the image data encoded
in
base64. I'm sure there's a library that can handle that for you,
although
I'm not very familiar with using ruby to manipulate email messages.



Alex
This topic is locked and can not be replied to.