Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;Youtube Link Parser! Credits to Wikked ( irc.g0dz.net +6697 (SSL ONLY) );;;;
- ;;;;;By OrFeAsGr: http://humanity.ucoz.com ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;; http://hawkee.com/snippet/17106/ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- on *:text:*:#: {
- tokenize 32 $strip($1-,burci)
- if (youtube.com isin $1-) { var %yt_t $gettok($1-,2,61) | set %yt_c # | _youtube %yt_t }
- if (youtu.be isin $1-) { var %yt_t $gettok($1-,3,47) | set %yt_c # | _youtube %yt_t }
- }
- on *:action:*:#: {
- tokenize 32 $strip($1-,burci)
- if (youtube.com isin $1-) { var %yt_t $gettok($1-,2,61) | set %yt_c # | _youtube %yt_t }
- if (youtu.be isin $1-) { var %yt_t $gettok($1-,3,47) | set %yt_c # | _youtube %yt_t }
- }
- alias _YouTube {
- sockclose $+(Ytb,.,$1)
- sockopen -e $+(Ytb,.,$1) www.googleapis.com 443
- }
- on *:sockopen:*: {
- if (Ytb* iswm $sockname) {
- if ($sockerr) { sockclose $sockname | halt }
- sockwrite -nt $sockname GET /youtube/v3/videos?id= $+ $remove($sockname,Ytb.) $+ &key=AIzaSyCzHxG53pxE0hWrWBIMMGm75PRHBQ8ZP8c&part=snippet,contentDetails,statistics,topicDetails HTTP/1.1
- sockwrite -nt $sockname Host: www.googleapis.com
- sockwrite -nt $sockname $crlf
- }
- }
- on *:sockread:*: {
- if (Ytb* iswm $sockname) {
- if ($sockerr) { return }
- var %read
- sockread -f %read
- while ($sockbr) {
- if (%read) {
- if ("title" isin $gettok(%read,1,32)) { set %yt_title $left($noqt($gettok(%read,2-,32)),-2) }
- if ("categoryId" isin $gettok(%read,1,32)) {
- var %a = $left($noqt($gettok(%read,2-,32)),-2)
- set %yt_category $replace(%a,1,Film & Animation,02,Autos & Vehicles,10,Music,15,Pets & Animals,17,Sports,18,Short Movies,19,Travel & Events,20,Gaming,21,Videoblogging,22,People & Blogs,23,Comedy,24,Entertainment,25,News & Politics,26,Howto & Style,27,Education,28,Science & Technology,29,Nonprofits & Activism,30,Movies,31,Anime/Animation,32,Action/Adventure,33,Classics,34,Comedy,35,Documentary,36,Drama,37,Family,38,Foreign,39,Horror,40,Sci-Fi/Fantasy,41,Thriller,42,Shorts,43,Shows,44,Trailers)
- }
- if ("viewCount" isin $gettok(%read,1,32)) { set %yt_views $left($noqt($gettok(%read,2-,32)),-2) }
- if ("likeCount" isin $gettok(%read,1,32)) { set %yt_likes $left($noqt($gettok(%read,2-,32)),-2) }
- if ("dislikeCount" isin $gettok(%read,1,32)) { set %yt_dislikes $left($noqt($gettok(%read,2-,32)),-2) }
- if ("channelTitle" isin $gettok(%read,1,32)) { set %yt_uploaded $left($noqt($gettok(%read,2-,32)),-2) }
- if ("duration" isin $gettok(%read,1,32)) { set %yt_duration $get_duration($left($noqt($gettok(%read,2-,32)),-1)) }
- if ("commentCount" isin $gettok(%read,1,32)) {
- set %yt_comments $noqt($gettok(%read,2-,32))
- sockclose $sockname
- msg %yt_c Title: %yt_title
- msg %yt_c Category: %yt_category
- msg %yt_c Views: $comma(%yt_views)
- msg %yt_c Likes: $comma(%yt_likes)
- msg %yt_c Dislikes: $comma(%yt_dislikes)]
- msg %yt_c Uploaded by: %yt_uploaded
- msg %yt_c Duration: %yt_duration
- unset %yt_*
- return
- }
- }
- sockread -f %read
- }
- }
- }
- alias get_duration {
- if (!$1) { return 0 }
- var %d = $1
- var %d = $remove(%d,P,T)
- var %d = $replacex(%d,W,wk $chr(32),D,days $chr(32),h,hrs $chr(32),M,mins $chr(32),S,secs)
- var %d = $duration(%d,3)
- var %dd = $duration(%d,3)
- return $iif(%dd,$v1,00:00:00)
- }
- alias get_date {
- if (!$1-) { return 0 }
- var %d = $1-
- var %d = $remove($replace(%d,$chr(84),$chr(32)),$chr(90))
- if (*.* iswm %d) {
- var %tmp_d = $gettok(%d,1,32)
- var %tmp_t = $remove($gettok(%d,2,32),.)
- var %d = %tmp_d $gettok(%tmp_t,1,58) $+ : $+ $gettok(%tmp_t,2,58) $+ : $+ $mid($gettok(%tmp_t,3,58),4)
- }
- var %d = $ctime($remove(%d,$chr(44)))
- var %d = $date(%d,ddd ddoo mmm yyyy HH:nn:ss)
- if (!$prop) { return %d }
- if ($prop) && ($prop == date) { return $iif(%d,$v1,0) }
- if ($prop) && ($prop == ctime) { return $iif($ctime(%d),$v1,0) }
- }
- alias -l comma {
- var %a, %b = $regsub($ticks,$1,/\G([+-]?\d+?)(?=(?:\d{3})++(?=\.\d++$|$))/g,\1 $+ $chr(44),%a)
- return %a
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement