Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- the referenced tldr.txt file contains data like the following:
- text=lots of text here
- with line returns too
- and it ends.&title=the title
- alias qpack return $regsubex($1-,/(\W)/g,$iif(\t !isin `~ !^*()-_\|{}[]"'<>.,% $+ $base($asc(\t),10,16,2),$iif(\t = $chr(32),+,\t)))
- alias tldr {
- sockopen -e tldr textteaser.p.mashape.com 443
- }
- on *:sockopen:tldr*:{
- var %x sockwrite -n $sockname
- %x POST /api HTTP/1.1
- %x Host: textteaser.p.mashape.com
- bread tldr.txt 1 $file(tldr.txt).size &f
- var %uri $qpack($bvar(&f,1-).text)
- %x Content-Length: $len(%uri)
- %x X-Mashape-Authorization: eEEEv3NMeEvUiZiOOjX3Y6Jt9YgwizK2
- %x
- %x %uri
- }
- on *:sockread:tldr*:{
- if ($sockerr) { echo -a SOCKET ERROR: $sockerr | halt }
- else {
- sockread &t
- echo -a $bvar(&t,1-).text
- var %pos $bfind(&t,1,{"id)
- var %pos2 $bfind(&t,%pos,"]})
- if (%pos2 != 0) {
- var %sockreader $bvar(&t,$+(%pos,-,$calc(%pos2 + 1))).text
- echo -a %sockreader
- sockclose $sockname
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement