[REBOL] Re: random music videos
From: ryan::christiansen::intellisol::com at: 31-May-2001 13:47
I guess I got lucky with the first couple of random numbers, because music
videos showed up. It seems you may need to refresh this URL quite a bit to
get any results. Ah, well.
[ryan--christiansen--inte]
llisol.com To: [rebol-list--rebol--com]
Sent by: cc:
[rebol-bounce--rebol--com] Subject: [REBOL] random music videos
05/31/2001 12:56 PM
Please respond to
rebol-list
If you'd like to view a random music video from the farmclub.com music
video archives, go to this handy-dandy REBOL music video grabber...
http://www.fargonews.com/cgi-bin/musicvideo.cgi
You WILL get a Javascript error. Just click "no" about debugging and the
video will play anyway. I don't know Javascript very well. If someone else
can help me fix that error, then great.
Also, if the script doesn't retrieve a music video, just hit refresh. The
script is using a random number for the video id and such a video may not
exist after all.
Enjoy! Here's the code.
#!rebol -cs
REBOL []
read-random-video: func [
vid-id
][
video-url: make url! (rejoin
[{http://www.farmclub.com/watch/videovault/me/vv_redirect?video_id=}
video-id {&m=}])
read video-url
]
random/seed now
if error? try [
video-id: random 11404
video-page: read-random-video video-id
][
video-id: random 11404
video-page: read-random-video video-id
]
parse video-page [thru <!-- nav_middle --> copy text to <!--END VIDEO
DISPLAY--> (video-javascript: copy text)]
print "Content-Type: text/html^/" ;-- Required Page Header
print rejoin [{<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN"><HTML><HEAD><TITLE></TITLE></HEAD><BODY>}
video-javascript {</BODY></HTML>}]
-Ryan