YouTube URL logger
Catches youtube urls into a seperate window. Fetches their titles, descriptions, ratings, views, comments, how many times favorited and if ratings/comments are disabled or not in one coherent place.
Also, writes the data to a youtube.txt as a duplicate hard copy.
It serves as a cohesive place for you to look through videos that have been recommended in channels and queries that you might have missed while AFK. In addition, the @YouTube window stores the context in which it was saved, while fetching its relevant details from the YouTube site so that you may know beforehand about its worthwhileness. IE: you can see how many times a video has been favorited and make a decision right there if you want to bother looking at that video or not.
Moreover, the snippet also logs these urls to a youtube.txt file so that you may use a search in your text editor in case you close the @window and want to look up a certain video again. However, it will only log videos that haven't already been mentioned by checking against already logged urls.
Please remember, that the YouTube video site is not static and that any changes in their site will break this script. In which case, I'll try my best to fix it.
dude its not working :[ :\ :/
but i changed it :P
TO:
on *:text:*:#: {
if (*youtube.com/watch?* iswm $1-) {
%yt.rating = 0
%yt.entry = $1-
set %yt.chan $chan
if ($window(@YouTube) == $null) {
msg %yt.chan Tittle: %yt.title - Favorite: $remove(%yt.favorited,<span class=\"watch-stat\">,</span>) - Ratings:4 $remove(%yt.numratings,<div id=\"ratingWrapper\"><div,class=\"floatL\",onclick=\"urchinTracker(\'/Events/VideoWatch/Rated\');\"><div,id=\"ratingStars\",class=\"floatL\"><img,class=\"ratingL,ratingL-4.5\",alt=\"4.57788461538\",src=\"http://s.ytimg.com/yt/img/pixel-vfl73.gif\",/><div,id=\"ratingMessage\">,><img,<div,id=\"hoverMessage\",style=\"width:100%\",class=\"hid\"><a href=\"/login?next=/watch%3Fv%3DH9mRL8C9MCM\">Sign,in</a>,to,rate)
}
if (http:// isin $1-) { %yt.path = / $+ $gettok($gettok($gettok($1-,3,47),1,38),1,32) }
else { %yt.path = / $+ $gettok($gettok($gettok($1-,2,47),1,38),1,32) }
%yt.nick = $nick
%yt.chan = $chan
%yt.surl = $remove(%yt.path,/watch?v=)
sockclose yt
sockopen yt youtube.com 80
}
}
on *:sockopen:yt:{
if ($sockerr) {
; echo -a $chr(91) $+ $time $+ $chr(93) YouTube: socket error
if (%yt.chan) {
msg %yt.chan $str(.,282)
msg %yt.chan ERROR: $+($chr(3),04,<,$chr(15),$date,$chr(3),04>,$chr(15)) $+($chr(3),04,<,$chr(15),$time,$chr(3),04>,$chr(15)) $+($chr(3),04,<,$chr(15),$network %yt.chan,$chr(3),04>,$chr(15)) $+($chr(3),04,<,$chr(15),%yt.nick,$chr(3),04>,$chr(15)) %yt.entry
write yterror.txt < $+ $date $+ > < $+ $time $+ > < $+ $network %yt.chan $+ > < $+ %yt.nick $+ > %yt.entry
}
if (%yt.chan == $null && %yt.nick != $null) {
msg %yt.chan $str(.,282)
msg %yt.chan ERROR: $+($chr(3),04,<,$chr(15),$date,$chr(3),04>,$chr(15)) $+($chr(3),04,<,$chr(15),$time,$chr(3),04>,$chr(15)) $+($chr(3),04,<,$chr(15),$network PM,$chr(3),04>,$chr(15)) $+($chr(3),04,<,$chr(15),%yt.nick,$chr(3),04>,$chr(15)) %yt.entry
write yterror.txt < $+ $date $+ > < $+ $time $+ > < $+ $network PM $+ > < $+ %yt.nick $+ > %yt.entry
}
halt
}
sockwrite -n $sockname GET %yt.path HTTP/1.1
sockwrite -n $sockname Host: youtube.com
sockwrite -n $sockname $crlf
}
on *:sockread:yt: {
:read
sockread -f %yt.read
if (Ratings have been disabled for this video isin %yt.read) { set %yt.ratingsdisabled no }
if (Adding comments has been disabled for this video isin %yt.read) { set %yt.commentsdisabled no }
if (icn_star_full_19x20png isin %yt.read) { %yt.rating = $count(%yt.read,star_full) }
if (ratings</span> isin %yt.read) { %yt.numratings = $remove(%yt.read, ,<div id=\"ratingMessage\" style=\"float:right\">,<div id=\"defaultRatingMessage\">,<span class=\"smallText\">, ratings</span>,</div>) }
if (<span class=\"viewCount\"> isin %yt.read) { %yt.views = $remove(%yt.read, ,<span class=\"viewCount\">,</span>) }
if (<span class=\"lightLabel\">Comments:</span> isin %yt.read) { %yt.comments = $remove(%yt.read, , ,<span class=\"lightLabel\">Comments:</span> ,<a href=\"/comment_servlet?,&all_comments,all_comments,&v=,&,v=,%yt.surl,\">,</a>) }
if (<span class=\"lightLabel\">Favorited:</span> isin %yt.read) { %yt.favorited = $remove(%yt.read, ,<span class=\"lightLabel\">Favorited:</span> , times) }
if (<meta name=\"title\" content=\" isin %yt.read) { %yt.title = $replace($remove(%yt.read, ,<meta name=\"title\" content=\",\">),<br/>,$chr(32),&,&,",\") }
if (<meta name=\"description\" content=\" isin %yt.read) { %yt.desc_re = $replace($remove(%yt.read, ,<meta name=\"description\" content=\",\">),<br/>,$chr(32),&,&,",\") }
;if (<title> isin %yt.read) { %yt.title = $remove(%yt.read, ,<title>YouTube - ,</title>) }
;if (%yt.found) { unset %yt.found | %yt.desc_be = $replace($remove(%yt.read, ),&,&) }
;if (<span id=\"vidDescBegin\"> isin %yt.read) { %yt.found = k }
;if (<span id=\"vidDescRemain\"> isin %yt.read) { %yt.desc_re = $replace($remove(%yt.read, ,<span id=\"vidDescRemain\">,</span>),<br/>,$chr(32),&,&,",\") }
if (<span class=\"smallLabel\">Category: </span> isin %yt.read) { %yt.done = k }
if (%yt.done) {
sockclose yt
unset %yt.done
if ($read(youtube.txt,w,* $+ %yt.path $+ *) != $null) { %yt.record = noop }
else { %yt.record = write }
%yt.num.rating = $remove(%yt.rating,$chr(44),$chr(32))
%yt.num.views = $remove(%yt.views,$chr(44),$chr(32))
%yt.num.numratings = $remove(%yt.numratings,$chr(44),$chr(32))
%yt.num.comments = $remove(%yt.comments,$chr(44),$chr(32))
%yt.num.favorited = $remove(%yt.favorited,$chr(44),$chr(32))
%yt.red.start = 4
%yt.red.stop =
%yt.maroon.start = 5
%yt.maroon.stop =
;viral or not
if (%yt.num.views >= 100000) {
%yt.boldstart.views = %yt.red.start
%yt.boldstop.views = %yt.red.stop
if (%yt.num.rating >= 4) { %yt.boldstart.rating = %yt.red.start | %yt.boldstop.rating = %yt.red.stop }
else { %yt.boldstart.rating = $null | %yt.boldstop.rating = $null }
}
elseif (%yt.num.views >= 15000 && %yt.num.views < 100000) { %yt.boldstart.views = %yt.maroon.start | %yt.boldstop.views = %yt.maroon.stop }
else { %yt.boldstart.views = $null | %yt.boldstop.views = $null }
if (%yt.num.numratings >= 350) { %yt.boldstart.numratings = %yt.red.start | %yt.boldstop.numratings = %yt.red.stop }
else { %yt.boldstart.numratings = $null | %yt.boldstop.numratings = $null }
if (%yt.num.comments >= 1000) { %yt.boldstart.comments = %yt.red.start | %yt.boldstop.comments = %yt.red.stop }
else { %yt.boldstart.comments = $null | %yt.boldstop.comments = $null }
if (%yt.num.favorited >= 700) { %yt.boldstart.favorited = %yt.red.start | %yt.boldstop.favorited = %yt.red.stop }
else { %yt.boldstart.favorited = $null | %yt.boldstop.favorited = $null }
:title
if (%yt.chan) { %yt.chanq = %yt.chan }
elseif (%yt.chan == $null && %yt.nick != $null) { %yt.chanq = PM }
msg %yt.chan $str(.,282)
msg %yt.chan 4 $+($chr(3),04,<,$chr(15),$date,$chr(3),04>,$chr(15)) $+($chr(3),04,<,$chr(15),$time,$chr(3),04>,$chr(15)) $+($chr(3),04,<,$chr(15),$network %yt.chanq,$chr(3),04>,$chr(15)) $+($chr(3),04,<,$chr(15),%yt.nick,$chr(3),04>,$chr(15)) %yt.entry
msg %yt.chan Title: %yt.title
%yt.record youtube.txt $str(.,261)
%yt.record youtube.txt < $+ $date $+ > < $+ $time $+ > < $+ $network %yt.chanq $+ > < $+ %yt.nick $+ > %yt.entry
%yt.record youtube.txt Title: %yt.title
}
}
1) The dots... well ... I sort of... like them :)
2) I fixed the () on the if statement
3) I was thinking about checking if the link existed or not and then posting accordingly. I decided against it because I didn\'t want to get too complicated and because I don\'t have that much experience to do that. Maybe someone can help me with that.
4) about using $fulldate, I went with what you said. But I think its just a matter of personal preference if someone wants to change that, its not that hard.
Thanks for the comments Lindrian
Oh and btw, since u can edit comments (argh x.x) ill have to post a second one, well, why dont u make a if statement to check if the youtube file is NOT in the txt file, and it will add it. No need to have multiple urls right ;p?
And u know, u can use $fulldate instead of \"YouTube window opened $day $+ , $date $+ , $time\" etc.