Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- ;script !imdb Script
- ;version 23.May.2017
- ;author mruno
- ;email [email protected]
- ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- ;23.May.2017 fixed movie plot
- ;18.NOV.2014 runtime and release date fix for movies like top dog 2014
- ;16.NOV.2014 Director Fix
- ;JULY.2014: will now detect imdb.com URLs in text and show the info
- ;type enable trailer links (when available with: /set %imdb.trailer on
- ;
- ;actor fixes
- ;Removed tagline
- ;Fixed new formatting on imdb.com
- ;Fixed rating on some titles (John Crowley)
- ;added link to trailers
- ;
- on *:TEXT:*:#: {
- if ($chr(36) isin $2-) return
- if ($1 == !imdb) || ($1 == !imdb2) {
- if (!$findtok(%imdb2,$nick,0,46)) {
- set -u10 %theatre $addtok(%imdb2,$nick,46)
- var %a = imdb2
- if ($hget(%a)) hfree %a
- h %a chan $chan
- h %a cid $cid
- h %a nick $nick
- h %a network $network
- imdb2 $nick $2-
- }
- else .timerimdb2. $+ $nick 1 1 .notice $nick Please wait 10 seconds and try again...
- }
- elseif (*imdb.com/title/tt*/* iswm $1-) {
- var %url $1-
- var %tt $gettok(%url,$calc($findtok(%url,title,47) + 1),47)
- if (tt isin %tt) {
- if (!$findtok(%imdb2,$nick,0,46)) {
- set -u10 %theatre $addtok(%imdb2,$nick,46)
- var %a imdb2
- if ($hget(%a)) hfree %a
- h %a chan $chan
- h %a cid $cid
- h %a nick $nick
- h %a network $network
- imdb2 $nick %tt
- }
- }
- }
- elseif (*imdb.com/name/nm*/* iswm $1-) {
- var %url $1-
- var %tt $gettok(%url,$calc($findtok(%url,name,47) + 1),47)
- if (nm isin %tt) {
- if (!$findtok(%imdb2,$nick,0,46)) {
- set -u10 %theatre $addtok(%imdb2,$nick,46)
- var %a imdb2
- if ($hget(%a)) hfree %a
- h %a chan $chan
- h %a cid $cid
- h %a nick $nick
- h %a network $network
- imdb2 $nick %tt
- }
- }
- }
- }
- on *:INPUT:#:{
- if ($1 == !imdb) || ($1 == !imdb2) {
- var %a = imdb2
- if ($hget(%a)) hfree %a
- h %a chan $chan
- h %a network $network
- h %a cid $cid
- h %a nick $me
- imdb2 $me $2-
- }
- }
- alias -l imdbhelp {
- var %cmd = .notice $1
- %cmd !iMDb[2] by mruno. Usage: !imdb [option] <title or ID>
- %cmd Options:
- %cmd Result types: Movie or Actor (Default is Movies) - "!imdb monica" - Performs a movie search and "!imdb -a monica" will perform an actor search.
- %cmd List results (Default is 5, Max of 10). Example: "!imdb -l5 hobbit" - Lists the top 5 search results.
- %cmd Recommended results (Default is 5, Max of 9). "!imdb -r5 hobbit" - Recommends movies based on the movie (or movie code) you specified.
- }
- alias imdb2 {
- var %h imdb2
- if (!$2) { imdbhelp $1 | return }
- if ($2 == -r) || ($2 == -l) || ($2 == -a) && (!$3) { imdbhelp $1 | return }
- elseif ($left($2,2) == -l) {
- .timerimdb2.gclean 0 60 imdb2.gclean
- var %a, %b, %p, %u, %o, %query
- if ($left($3,2) == tt) && ($remove($3,tt,/) isnum) {
- h %h results 1
- h %h result 1
- h %h query code.movie
- }
- else {
- h %h results $iif($remove($2,-l),$remove($2,-l),5)
- h %h result $iif($remove($2,-l),$remove($2,-l),5)
- h %h query list
- }
- set %query $replace($3-,$chr(32),+,.,+,-,+)
- h %h text %query
- ;.notice $h(%h ,nick) Searching iMDb.com...
- set %u http://m.imdb.com/find?q= $+ %query
- h %h u %u
- imdb2.download imdb2.search %u imdb2.txt
- ;echo -a ------ %u ---------------
- }
- elseif ($left($2,2) == -r) {
- .timerimdb2.gclean 0 60 imdb2.gclean
- var %a, %b, %p, %u, %o, %query
- h %h results $iif($remove($2,-r),$remove($2,-r),5)
- h %h result $iif($remove($2,-r),$remove($2,-r),5)
- h %h query recommend
- set %query $replace($3-,$chr(32),+,.,+,-,+)
- h %h text %query
- ;.notice $h(%h ,nick) Searching iMDb.com...
- set %u http://m.imdb.com/find?q= $+ %query
- h %h u %u
- if ($left($3,2) == tt) && ($remove($3,tt,/) isnum) {
- h %h url http://www.imdb.com/title/ $+ $h(%h,text)
- imdb2.download imdb2.results http://m.imdb.com/title/ $+ $h(%h,text) imdb2.txt
- }
- else imdb2.download imdb2.search %u imdb2.txt
- ;echo -a ------ %u ---------------
- }
- elseif ($2 == -a) {
- .timerimdb2.gclean 0 60 imdb2.gclean
- var %a, %b, %p, %u, %o, %query
- h %h results 1
- h %h result 1
- h %h query actor
- set %query $replace($3-,$chr(32),+,.,+,-,+)
- h %h text %query
- ;.notice $h(%h ,nick) Searching iMDb.com...
- set %u http://m.imdb.com/find?q= $+ %query
- h %h u %u
- imdb2.download imdb2.search %u imdb2.txt
- ;echo -a ------ %u ---------------
- }
- else {
- .timerimdb2.gclean 0 60 imdb2.gclean
- var %a, %b, %p, %u, %o, %query
- h %h results 1
- h %h result 1
- if ($left($2,2) == nm) && ($remove($2,nm,/) isnum) h %h query code.actor
- elseif ($left($2,2) == tt) && ($remove($2,tt,/) isnum) h %h query code.movie
- else h %h query movie
- set %query $replace($2-,$chr(32),+,.,+,-,+)
- h %h text %query
- ;.notice $h(%h,nick) Searching iMDb.com...
- set %u http://m.imdb.com/find?q= $+ %query
- h %h u %u
- imdb2.download imdb2.search %u imdb2.txt
- ;echo -a ------ %u ---------------
- }
- }
- alias -l imdb2.search {
- ;this alias is triggered once the search page is downloaded
- if ($1 == 1) && ($2 == S_OK) {
- var %a = @imdb2, %b, %d = 0, %e, %z = 0, %t, %cmd, %h = imdb2, %raw, %h = imdb2
- if ($window(%a)) window -c %a
- window -h %a
- loadbuf %a imdb2.txt
- ;this removes extra crap from the beginning of the webpage
- ;<a href="/title/
- if ($h(%h,query) == actor) dline %a 1- $+ $calc($fline(%a,*<a href="/name/*,1) - 8)
- elseif ($h(%h,query) == movie) dline %a 1- $+ $calc($fline(%a,*<a href="/title/*,1) - 8)
- elseif ($h(%h,query) == code.actor) {
- h %h url http://www.imdb.com/name/ $+ $h(%h,text)
- imdb2.download imdb2.results http://m.imdb.com/name/ $+ $h(%h,text) imdb2.txt
- goto end
- }
- elseif ($h(%h,query) == code.movie) {
- h %h url http://www.imdb.com/title/ $+ $h(%h,text)
- imdb2.download imdb2.results http://m.imdb.com/title/ $+ $h(%h,text) imdb2.txt
- goto end
- }
- elseif ($h(%h,query) == list) {
- dline %a 1- $+ $calc($fline(%a,*<h1>Search results</h1>*,1) - 8)
- var %loop = 1
- dualcmd [iMDb] Movie List Results:
- ;while ($fline(%a,**<a href="*" onClick="**,%loop)) {
- while ($fline(%a,*<a href="/title/tt*,%loop)) {
- var %match = $ifmatch
- dualcmd %loop $+ ) $striphtml($line(%a,%match)) - Code: $+ $gettok($line(%a,%match),3,47) $+
- inc %loop
- if (%loop > 10) || (%loop > $h(%h,results)) break
- }
- dualcmd Type !imdb <code> for more info
- goto end
- }
- else dline %a 1- $+ $calc($fline(%a,*<a href="/title/*,1) - 8)
- if ($fline(%a,*<div class="noResults">No Results</div>*,1)) {
- dualcmd No results for: $replace($h(%h,text),+,$chr(32))
- .timerimdb2.gclean 1 60 imdb2.gclean
- return
- }
- ;this records initial data from search page.
- set %raw $line(%a,$calc($fline(%a,*<div class="title">*,1) + 1))
- h %h title $striphtml(%raw)
- h %h url http://www.imdb.com $+ $gettok(%raw,2,34)
- if ($striphtml($line(%a,$fline(%a,*<div class="detail">*,1)))) h %h cast $ifmatch
- :recommend
- if ($h(%h,query) == recommend) imdb2.download imdb2.recommend http://www.imdb.com $+ $gettok(%raw,2,34) $+ recommendations imdb2.txt
- ;echo -s http://www.imdb.com $+ $gettok(%raw,2,34) $+ recommendations
- else {
- ;time to download the title's webpage
- imdb2.download imdb2.results http://m.imdb.com $+ $gettok(%raw,2,34) imdb2.txt
- }
- :end
- }
- else $iif($h(imdb2,nick) == $me || !$h(imdb2,nick),.notice $me,msg $h(imdb2,chan)) Error downloading data - 1. See $+ $replace($h(imdb2,u),http://m.,http://www.)
- .timerimdb2.gclean 1 60 imdb2.gclean
- }
- alias -l imdb2.recommend {
- ;this alias parses the recommended info
- if ($1 == 1) && ($2 == S_OK) {
- var %a = @imdb2, %h = imdb2
- if ($window(%a)) window -c %a
- window -h %a
- loadbuf %a imdb2.txt
- var %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %loop = 0, %raw
- if ($fline(%a,*<b>Suggested by the database</b>*,0)) {
- while (%loop < $h(imdb2,result)) {
- inc %loop
- set %raw $matchtok($line(%a,$calc($fline(%a,*<b>Suggested by the database</b>*,1) + 4)),<a href="/title/,%loop,44)
- if ($striphtml($gettok($gettok(%raw,2,60),2,62))) h %h title $+ %loop $striphtml($gettok($gettok(%raw,2,60),2,62))
- if ($gettok($gettok(%raw,2,40),1,41) isnum) h %h year $+ %loop ( $+ $gettok($gettok(%raw,2,40),1,41) $+ )
- if ($remove($gettok($striphtml(%raw),$gettok($striphtml(%raw),0,41),41),.,$chr(32)) isnum) h %h rating $+ %loop $gettok($striphtml(%raw),$gettok($striphtml(%raw),0,41),41)
- if ($left($gettok($gettok($gettok(%raw,2,60),1,62),3,47),2) == tt) h %h code $+ %loop $gettok($gettok($gettok(%raw,2,60),1,62),3,47)
- }
- if ($h(%h,title1)) {
- dualcmd [iMDb] Recommended Movies 14(based on $h(%h,title) $+ ) $+ :
- var %loopecho = 1
- while ($h(%h,title $+ %loopecho)) {
- dualcmd %loopecho $+ ) $h(%h,title $+ %loopecho) $iif($h(%h,year $+ %loopecho),$h(%h,year $+ %loopecho)) $iif($h(%h,rating $+ %loopecho),Rating: $h(%h,rating $+ %loopecho)) $iif($h(%h,code $+ %loopecho), - Code: $+ $h(%h,code $+ %loopecho))
- inc %loopecho
- if (%loopecho > 9) || (%loopecho > $h(%h,results)) break
- }
- dualcmd Type !imdb <code> for more info
- }
- }
- else dualcmd There are no recommendations for: $h(%h,title)
- .timerimdb2.gclean 1 60 imdb2.gclean
- }
- else $iif($h(imdb2,nick) == $me,.notice $me,msg $h(imdb2,chan)) Error downloading data - 2. See $+ $replace($h(imdb2,u),http://m.,http://www.)
- .timerimdb2.gclean 1 60 imdb2.gclean
- }
- alias -l imdb2.results {
- ;this alias parses the results info
- if ($1 == 1) && ($2 == S_OK) {
- var %a = @imdb2, %b, %d = 0, %e, %z = 0, %t, %cmd, %h = imdb2, %raw
- if ($window(%a)) window -c %a
- window -h %a
- loadbuf %a imdb2.txt
- ;this removes extra crap from the beginning of the webpage
- if (movie isin $h(%h,query)) noop
- else dline %a 1- $+ $calc($fline(%a,*</title>*,1) - 2)
- if (/name/ isin $h(%h,url)) {
- ;this is for actors
- if (!$h(%h,title)) h %h title $striphtml($line(%a,$fline(%a,*<div class="title">*,1)))
- h %h birthname $striphtml($line(%a,$calc($fline(%a,*<h3>Born</h3>*,1) + 2)))
- h %h birthdate $line(%a,$calc($fline(%a,*<strong>Born:</strong>*,1) + 3)) $line(%a,$calc($fline(%a,*<strong>Born:</strong>*,1) + 5))
- h %h birthplace $striphtml($line(%a,$calc($fline(%a,*<h3>Born</h3>*,1) + 11)))
- ;'known for' loop
- var %loop = 1, %titles
- while ($fline(%a,*<a href="/title/*,%loop)) {
- set %titles $addtok( %titles, $striphtml($line(%a,$ifmatch)), 44)
- inc %loop
- }
- h %h knownfor $replace(%titles,$chr(44),$chr(44) $chr(32))
- ;h %h Bio $striphtml($line(%a,$calc($fline(%a,*<h1>Mini Biography</h1>*,1) + 2)))
- h %h Bio $line(%a,$calc($fline(%a,*<a href="bio?ref_=m_mn_ov_bio" class="btn-full" > <p>*,1) + 1))
- h %h news $striphtml($line(%a,$calc($fline(%a,*<h1>News</h1>*,1) + 3)))
- if (- imdb !isin $line(%a,$calc($fline(%a,*<h3>Trademark</h3>*,1) + 2))) h %h trademark $v2
- }
- else {
- ;this is for movies
- if (!$h(%h,title)) h %h title $remove($striphtml($line(%a,$fline(%a,*<title>*- IMDb*,1))), - IMDb)
- if ($h(%h,query) == recommend) {
- imdb2.download imdb2.recommend http://www.imdb.com/title/ $+ $h(%h,text) $+ /recommendations imdb2.txt
- goto endofresults
- }
- if ($line(%a,$fline(%a,*<strong>Play Trailer</strong>*,1))) && (%imdb.trailer == on) && ($gettok($gettok($ifmatch,5,47),1,63)) h %h trailer www.imdb.com/video/imdb/ $+ $gettok($gettok($ifmatch,5,47),1,63)
- ;<span class="button-1 primary"><a href="/video/imdb/vi2340006169">Watch Trailer</a></span>
- ;h %h tagline $striphtml($line(%a,$calc($fline(%a,* $+ $gettok($h(imdb2,title),1,40) $+ *,1) + 1)))
- ;if ($striphtml($line(%a,$calc($fline(%a,*<h1>Director*</h1>*,1) + 2)))) h %h director $ifmatch
- if ($striphtml($line(%a,$calc($fline(%a,*<h3 class="inline-block">Director:</h3>*,1) + 2)))) h %h director $ifmatch
- ;if ($striphtml($line(%a,$calc($fline(%a,*<h1>Release Date</h1>*,1) + 1)))) h %h releasedate $ifmatch
- if ($striphtml($line(%a,$calc($fline(%a,*<h3 class="inline-block">Release Date:</h3>*,1) + 1)))) h %h releasedate $ifmatch
- ;genre loop
- var %loop 0
- while ($fline(%a,*<span class="itemprop" itemprop="genre">*,0) > %loop) {
- inc %loop
- if ($striphtml($line(%a,$calc($fline(%a,*<span class="itemprop" itemprop="genre">*,%loop) + 0)))) h %h genre $addtok($ifmatch,$h(%h,genre),32)
- }
- if ($striphtml($line(%a,$calc($fline(%a,*<time itemprop="duration"*,1) + 1)))) h %h runtime $ifmatch
- if ($len($h(%h,runtime)) > 10) h %h runtime 0
- if ($line(%a,$calc($fline(%a,*<span title="*,1) + 0))) h %h rating $gettok($ifmatch,2,34)
- if ($striphtml($line(%a,$calc($fline(%a,*<p itemprop="description" class="plot-description">*,1) + 1)))) h %h plot $remove($ifmatch,See full summary »)
- if ($striphtml($line(%a,$calc($fline(%a,*<span class="mobile-sprite yellow-star">*,1) + 0)))) {
- var %score $gettok($remove($ifmatch,$chr(32)),1,47)
- var %votes $gettok($ifmatch,3,32)
- if (needs isin %score) || ($remove(%score,.) == Rate this movie) || (!%score) || (!%votes) h %h score none
- else {
- h %h score %score
- h %h votes %votes
- }
- }
- }
- imdb2.complete
- }
- else $iif($h(imdb2,nick) == $me,.notice $me,msg $h(imdb2,chan)) Error downloading data - 3. See $+ $replace($h(imdb2,u),http://m.,http://www.)
- :endofresults
- .timerimdb2.gclean 1 60 imdb2.gclean
- }
- alias -l imdb2.complete {
- ;this alias produces the text
- var %h = imdb2
- if (/name/ isin $h(%h,url)) {
- dualcmd [iMDb] $h(%h,title) $+ $chr(40) 12 $+ $h(%h,url) $+ $chr(41)
- dualcmd $iif($h(%h,birthname),Born: $h(%h,birthname)) $iif($h(%h,birthdate) && java !isin $h(%h,birthdate),Birthday: $h(%h,birthdate)) $iif($h(%h,birthplace) && commentary !isin $h(%h,birthplace),Birthplace: $h(%h,birthplace))
- dualcmd $iif($h(%h,trademark),Trademark: $h(%h,trademark))
- dualcmd $iif($h(%h,knownfor),Known for: $h(%h,knownfor))
- dualcmd $iif($h(%h,bio),Biography: $h(%h,bio))
- dualcmd $iif($h(%h,news),News: $h(%h,news))
- }
- else {
- dualcmd [iMDb] $h(%h,title) $+ $chr(40) 12 $+ $h(%h,url) $+ $chr(41)
- dualcmd $iif($h(%h,rating),Rated: $h(%h,rating)) $iif($h(%h,releasedate),Released: $h(%h,releasedate)) $iif($h(%h,runtime),Runtime: $h(%h,runtime)) $iif($h(%h,genre),Genre: $h(%h,genre))
- dualcmd $iif($h(%h,tagline),Tagline: $h(%h,tagline)) $iif($h(%h,trailer),Trailer: $+ http:// $+ $h(%h,trailer) $+ )
- dualcmd $iif($h(%h,director),Director: $h(%h,director)) $iif($h(%h,cast),Cast: $replace($h(%h,cast),$chr(187),$chr(44)))
- dualcmd $iif($h(%h,plot),Plot: $h(%h,Plot))
- var %r = $h(%h,score)
- if (rate this isin %r) || (%r == n/a) || (!%r) || (%r == none) dualcmd Rating: none
- else dualcmd Rating: $chr(91) $+ $iif(%r > .55,12,) $+ * $+ $iif(%r > 1.55,12,) $+ * $+ $iif(%r > 2.55,12,) $+ * $+ $iif(%r > 3.55,12,) $+ * $+ $iif(%r > 4.55,12,) $+ * $+ $iif(%r > 5.55,12,) $+ * $+ $iif(%r > 6.55,12,) $+ * $+ $iif(%r > 7.55,12,) $+ * $+ $iif(%r > 8.55,12,) $+ * $+ $iif(%r > 9.55,12,) $+ *] %r $+ /10 $paren($h(%h,votes) votes)
- }
- .timerimdb2.gclean 1 60 imdb2.gclean
- }
- alias -l h {
- if ($1 == isnum) return
- if (!$2) { echo -a error: no 2 for hash table | return }
- if (!$hget($1)) hmake $1 10
- if ($isid) return $hget($1,$2)
- else hadd $1 $2-
- }
- alias -l dualcmd {
- if ($1) {
- if ($me ison $h(imdb2,chan)) msg $h(imdb2,chan) $1-
- }
- }
- alias -l paren {
- if ($3) return $2 $+ $1 $+ $3
- elseif ($2) return $2 $+ $1 $+ $2
- elseif ($1 != $null) return ( $+ $1- $+ )
- }
- alias imdb2.gclean {
- ;this removes the hash tables that were used AND closes @imdb2
- if (%imdb2) return
- var %r = 0
- while (%r < $hget(imdb2,results)) {
- inc %r
- if ($hget(imdb2. $+ $hget(imdb2,query) $+ %r)) hfree $ifmatch
- }
- set %r $hget(0)
- while (%r) {
- dec %r
- if (imdb2.* iswm $hget(%r)) hfree $v2
- }
- if ($hget(imdb2)) hfree $ifmatch
- set %r $findfile($mircdir,imdb2*.txt,0,1,.remove $1-)
- set %r $findfile($mircdir,imdb2.download*.vbs,0,1,.remove $1-)
- if ($window(@imdb2)) window -c @imdb2
- unset %imdb2
- }
- on 1:UNLOAD:{
- imdb2.gclean
- }
- ;==================================================================================
- ;Author : fubar
- ;Function: $striphtml identifier
- ; This identifier strips html code from a string of text.
- ; Good for using when retrieving webpages within mirc.
- ;==================================================================================
- ;
- ;This identifier strips html code from a string of text. Good for using when retrieving webpages within mirc.
- ;
- ;Usage: $striphtml(html code)
- alias -l Xchr {
- var %return $regsubex($regsubex($1-,/&#x([A-F0-9]{1,2});/g,$chr($base($regml(\n),16,10))),/&#([0-9]{2});/g,$chr(\1))
- return $replacecs(%return,–,,·,·,»,»,«,«,Ü,Ü,ü,ü,Á,Á,á,á,É,$&
- É,é,é,Í,Í,í,í,Ó,Ó,ó,ó,Ñ,Ñ,ñ,ñ,Ú,Ú,ú,ú, ,$chr(32),$&
- æ,æ,",")
- }
- alias -l striphtml {
- ; making sure there are parameters to work with
- IF ($1) {
- ; Setting my variables. The %opt is set kind of funky
- ; all it does is combine <two><brackets> into 1 <twobrackets>, fewer loops this way
- ; also stripped tab spaces
- VAR %strip,%opt = <> $remove($1-,> <,><,$chr(9)) <>,%n = 2
- ; using $gettok() I checked the text in front of '>' (chr 62)
- ; then the second $gettok checks the text behind '<' (chr 60)
- ; so I'm extracting anything between >text<
- WHILE ($gettok($gettok(%opt,%n,62),1,60)) {
- ; take each peice of text and add it to the same variable
- %strip = %strip $ifmatch
- %strip = $replace(%strip,",")
- ; increase the variable so the while statement can check the next part
- INC %n
- }
- ; now that the loop has finished we can return the stripped html code
- RETURN $Xchr(%strip)
- }
- }
- ;/download by SReject
- ;http://www.hawkee.com/snippet/9318/
- alias imdb2.download {
- if ($regex(Args,$1-,^-c (?|(?:"(?=.+")([^"]+)")|(\S+)) (\S+) (?|(?:"(?=.+")([^"]+)")|(\S+)) (\S+)$)) {
- var %callback = $regml(Args,1)
- var %url = $regml(Args,2)
- var %file = $qt($regml(Args,3))
- var %com = $regml(Args,4)
- var %r = $iif($comerr,1,$com(%com).result)
- .remove $qt($scriptdir $+ %com)
- if ($com(%com)) { .comclose %com }
- if (%r == -1) { %callback 1 S_OK %url $qt(%file) }
- elseif (%r == 1) { %callback 0 UnKnown_ComErr %url $qt(%file) }
- elseif (%r == 2) { %callback 0 IE6+_Needed %url $qt(%file) }
- elseif (%r == 3) { %callback 0 Connect_Error %url $qt(%file) }
- elseif (%r == 4) { %callback 0 Newer_ActiveX_Needed %url $qt(%file) }
- elseif (%r == 5) { %callback 0 Writefile_Error %url $qt(%file) }
- else { %callback 0 Unknown_Error %url $qt(%file) }
- }
- elseif ($1 != -c) {
- if ($isid) || (!$regex(Args,$1-,^(?|(?:"(?=.+")([^"]+)")|(\S+)) (\S+) (?|(?:"(?=.+")([^"]+)")|(\S+))$)) || ($regml(Args,0) != 3) { return }
- var %callback = $regml(Args,1)
- var %url = $qt($regml(Args,2))
- var %file = $qt($iif(: isin $regml(Args,3),$v2,$mircdir $+ $v2))
- var %com = imdb2.download $+ $ticks $+ .vbs
- var %s = $qt($scriptdir $+ %com)
- var %w = write %s
- %w on error resume next
- %w Set C = CreateObject("msxml2.xmlhttp.3.0")
- %w if (err.number <> 0) then
- %w err.clear
- %w set C = CreateObject("msxml2.xmlhttp")
- %w if (err.number <> 0) then
- %w err.clear
- %w set C = CreateObject("XMLHttpRequest")
- %w if (err.number <> 0) then wscript.quit(2)
- %w end if
- %w end if
- %w C.open "GET", %url $+ , false
- %w C.send
- %w if (err.number <> 0) then wscript.quit(3)
- %w set O = createobject("adodb.stream")
- %w if (err.number <> 0) then wscript.quit(4)
- %w O.type=1
- %w O.mode=3
- %w O.open
- %w O.write C.responsebody
- %w O.savetofile %file $+ ,2
- %w if (err.number <> 0) then wscript.quit(5)
- %w O.close
- %w wscript.quit(-1)
- .comopen %com WScript.Shell
- if ($comerr || !$comcall(%com,imdb2.download -c $qt(%callback) $noqt(%url) %file,run,1,bstr*,%s,uint,1,bool,true)) { goto error }
- return
- }
- :error
- if ($error) { reseterror }
- if ($isfile(%s)) { .remove %s }
- if ($com(%com)) { .comclose %com }
- }
- alias -l Xchr {
- var %return $regsubex($regsubex($1-,/&#x([A-F0-9]{1,2});/g,$chr($base($regml(\n),16,10))),/&#([0-9]{2});/g,$chr(\1))
- return $replacecs(%return,–,,·,·,»,»,«,«,Ü,Ü,ü,ü,Á,Á,á,á,É,$&
- É,é,é,Í,Í,í,í,Ó,Ó,ó,ó,Ñ,Ñ,ñ,ñ,Ú,Ú,ú,ú, ,$chr(32),$&
- æ,æ,",")
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement