[WebDNA] Code - API - Long URL Expander

This WebDNA talk-list message is from

2013


It keeps the original formatting.
numero = 110957
interpreted = N
texte = --089e0115fd3e24d05304edc9e364 Content-Type: text/plain; charset=ISO-8859-1 I just put this together for something after coming across this api tonight. The api seems to be pretty powerful - if you ever have need to expand shortened links. API Docs: http://longurl.org/api Known services it expands urls from: http://api.longurl.org/v2/services I didn't add any error checking for incomplete data being returned. This snippet returns: url_link url_title meta-keywords meta-description [text]showWork=1[/text] [text]showOutPut=1[/text] [text]crlf=[unurl]%0D%0A[/unurl][/text] [text]theLink=http://bit.ly/1dlSrIO[/text] [text]url_title=[/text] [text]meta-keywords=[/text] [text]url_description=[/text] [text]theOutPut=[tcpconnect host=api.longurl.org] [tcpsend skipheader=T]GET /v2/expand?url=[url][theLink][/url]&title=1&meta-keywords=1&meta-description=1&format=json HTTP/1.0[!] [/!][UnURL]%0D%0A[/Unurl]Host: api.longurl.org [UnURL]%0D%0A%0D%0A[/UnURL][UnURL]%0D%0A[/Unurl][!] [/!][/tcpsend][/tcpconnect][/text] [showif [showWork]=1] theOutPut: [theOutPut]

[/showif] [table name=JSON_Convert&fields=from,to] { } " [/table] [table name=JSON_ConvertLink&fields=from,to] %5C [/table] [text]theOutPut2=[grep search=","&replace=|&ignorecase=T][theOutPut][/grep][/text] [text]theOutPut3=[grep search=":"&replace=|&ignorecase=T][theOutPut2][/grep][/text] [text]message_Clean=[convertchars table=JSON_Convert][theOutPut3][/convertchars][/text] [showif [showWork]=1] message_Clean: [message_Clean]
[/showif] [ListWords Words=[url][message_Clean][/url]&Delimiters=|] [showif [index]=2] [text]url_link=[convertchars table=JSON_ConvertLink][word][/convertchars][/text] [/showif] [showif [index]=4] [text]url_title=[unurl][word][/unurl][/text] [/showif] [showif [index]=6] [text]meta-keywords=[convertchars table=JSON_Convert][word][/convertchars][/text] [/showif] [showif [index]=8] [text]url_description=[convertchars table=JSON_Convert][word][/convertchars][/text] [/showif] [/listwords] [showif [showOutPut]=1] url_link: [url_link]
--
url_title: [url_title]
--
meta-keywords: [meta-keywords]
--
url_description: [url_description]
-----------------
[/showif] --089e0115fd3e24d05304edc9e364 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I just put this together for something= after coming across this api tonight. The api seems to be pretty powerful = - if you ever have need to expand shortened links.
<= br>
API Docs: http://longurl.org/api
Known services it expands urls from: http://api.longurl.org/v2/services


I didn't add any error checking for incomplete data being returned= .

This snippet returns:
url_link
=
url_title
meta-keywords
meta-description
[text]showWork=3D1[/text]
[text]showOutPut=3D1[/text]
=
[text]crlf=3D[unurl]%0D%0A[/unurl][/text]
[text]theLink=3Dhttp://bit.ly/1dlSrIO[/text]


= [text]url_title=3D[/text]
[text]meta-keywords=3D[/text]
[text]url_description=3D[/text]





[text]theOutPut=3D[tcpconnect host=3Dapi.longurl.org]
[tcpsend skipheader=3DT]GET /v2/expan= d?url=3D[url][theLink][/url]&title=3D1&meta-keywords=3D1&meta-d= escription=3D1&format=3Djson HTTP/1.0[!]
[/!][UnURL]%0D%0A[/Unurl]Host: api.longu= rl.org[UnURL]%0D%0A%0D%0A[/UnURL][UnURL]%0D%0A[/Unurl][!]
[/!][/tcps= end][/tcpconnect][/text]

[showif [showWork]=3D1]
=A0=A0=A0 theOut= Put: [theOutPut]<br /><br>
[/showif]



[table name=3DJSON_Convert&fields=3Dfrom,to]{=A0=A0
}=A0=A0
"=A0=A0
[/table]

[table name=3DJS= ON_ConvertLink&fields=3Dfrom,to]
%5C=A0=A0=A0
[/table]

[t= ext]theOutPut2=3D[grep search=3D","&replace=3D|&ignorecas= e=3DT][theOutPut][/grep][/text]
[text]theOutPut3=3D[grep search=3D":"&replace=3D|&ignorec= ase=3DT][theOutPut2][/grep][/text]

[text]message_Clean=3D[convertcha= rs table=3DJSON_Convert][theOutPut3][/convertchars][/text]

[showif [= showWork]=3D1]
=A0=A0=A0 message_Clean: [message_Clean]<br>
[/showif]


= [ListWords Words=3D[url][message_Clean][/url]&Delimiters=3D|]




[showif [index]=3D2]
=A0=A0=A0 [text]url_link=3D[convertch= ars table=3DJSON_ConvertLink][word][/convertchars][/text]
[/showif]

[showif [index]=3D4]
=A0=A0=A0 [text]url_title=3D[unurl= ][word][/unurl][/text]
[/showif]

[showif [index]=3D6]
=A0=A0= =A0 [text]meta-keywords=3D[convertchars table=3DJSON_Convert][word][/conver= tchars][/text]
[/showif]

[showif [index]=3D8]
=A0=A0=A0 [text]url_description=3D[convertchars= table=3DJSON_Convert][word][/convertchars][/text]
[/showif]


=

[/listwords]

[showif [showOutPut]=3D1]
=A0=A0=A0 <stro= ng>url_link</strong>: [url_link]<br>
=A0=A0=A0 --<br>
=A0=A0=A0 <strong>url_title</strong>:= [url_title]<br>
=A0=A0=A0 --<br>
=A0=A0=A0 <strong>= ;meta-keywords</strong>: [meta-keywords]<br>
=A0=A0=A0 --<= ;br>
=A0=A0=A0 <strong>url_description</strong>: [url_des= cription]<br>
=A0=A0=A0 -----------------<br>
[/showif]
--089e0115fd3e24d05304edc9e364-- Associated Messages, from the most recent to the oldest:

    
  1. [WebDNA] Code - API - Long URL Expander (David Bastedo 2013)
--089e0115fd3e24d05304edc9e364 Content-Type: text/plain; charset=ISO-8859-1 I just put this together for something after coming across this api tonight. The api seems to be pretty powerful - if you ever have need to expand shortened links. API Docs: http://longurl.org/api Known services it expands urls from: http://api.longurl.org/v2/services I didn't add any error checking for incomplete data being returned. This snippet returns: url_link url_title meta-keywords meta-description [text]showWork=1[/text] [text]showOutPut=1[/text] [text]crlf=[unurl]%0D%0A[/unurl][/text] [text]theLink=http://bit.ly/1dlSrIO[/text] [text]url_title=[/text] [text]meta-keywords=[/text] [text]url_description=[/text] [text]theOutPut=[tcpconnect host=api.longurl.org] [tcpsend skipheader=T]GET /v2/expand?url=[url][theLink][/url]&title=1&meta-keywords=1&meta-description=1&format=json HTTP/1.0[!] [/!][unurl]%0D%0A[/Unurl]Host: api.longurl.org [unurl]%0D%0A%0D%0A[/UnURL][unurl]%0D%0A[/Unurl][!] [/!][/tcpsend][/tcpconnect][/text] [showif [showWork]=1] theOutPut: [theOutPut]

[/showif] [table name=JSON_Convert&fields=from,to] { } " [/table] [table name=JSON_ConvertLink&fields=from,to] %5C [/table] [text]theOutPut2=[grep search=","&replace=|&ignorecase=T][theOutPut][/grep][/text] [text]theOutPut3=[grep search=":"&replace=|&ignorecase=T][theOutPut2][/grep][/text] [text]message_Clean=[convertchars table=JSON_Convert][theOutPut3][/convertchars][/text] [showif [showWork]=1] message_Clean: [message_Clean]
[/showif] [ListWords Words=[url][message_Clean][/url]&Delimiters=|] [showif [index]=2] [text]url_link=[convertchars table=JSON_ConvertLink][word][/convertchars][/text] [/showif] [showif [index]=4] [text]url_title=[unurl][word][/unurl][/text] [/showif] [showif [index]=6] [text]meta-keywords=[convertchars table=JSON_Convert][word][/convertchars][/text] [/showif] [showif [index]=8] [text]url_description=[convertchars table=JSON_Convert][word][/convertchars][/text] [/showif] [/listwords] [showif [showOutPut]=1] url_link: [url_link]
--
url_title: [url_title]
--
meta-keywords: [meta-keywords]
--
url_description: [url_description]
-----------------
[/showif] --089e0115fd3e24d05304edc9e364 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I just put this together for something= after coming across this api tonight. The api seems to be pretty powerful = - if you ever have need to expand shortened links.
<= br>
API Docs: http://longurl.org/api
Known services it expands urls from: http://api.longurl.org/v2/services


I didn't add any error checking for incomplete data being returned= .

This snippet returns:
url_link
=
url_title
meta-keywords
meta-description
[text]showWork=3D1[/text]
[text]showOutPut=3D1[/text]
=
[text]crlf=3D[unurl]%0D%0A[/unurl][/text]
[text]theLink=3Dhttp://bit.ly/1dlSrIO[/text]


= [text]url_title=3D[/text]
[text]meta-keywords=3D[/text]
[text]url_description=3D[/text]





[text]theOutPut=3D[tcpconnect host=3Dapi.longurl.org]
[tcpsend skipheader=3DT]GET /v2/expan= d?url=3D[url][theLink][/url]&title=3D1&meta-keywords=3D1&meta-d= escription=3D1&format=3Djson HTTP/1.0[!]
[/!][unurl]%0D%0A[/Unurl]Host: api.longu= rl.org[unurl]%0D%0A%0D%0A[/UnURL][unurl]%0D%0A[/Unurl][!]
[/!][/tcps= end][/tcpconnect][/text]

[showif [showWork]=3D1]
=A0=A0=A0 theOut= Put: [theOutPut]<br /><br>
[/showif]



[table name=3DJSON_Convert&fields=3Dfrom,to]{=A0=A0
}=A0=A0
"=A0=A0
[/table]

[table name=3DJS= ON_ConvertLink&fields=3Dfrom,to]
%5C=A0=A0=A0
[/table]

[t= ext]theOutPut2=3D[grep search=3D","&replace=3D|&ignorecas= e=3DT][theOutPut][/grep][/text]
[text]theOutPut3=3D[grep search=3D":"&replace=3D|&ignorec= ase=3DT][theOutPut2][/grep][/text]

[text]message_Clean=3D[convertcha= rs table=3DJSON_Convert][theOutPut3][/convertchars][/text]

[showif [= showWork]=3D1]
=A0=A0=A0 message_Clean: [message_Clean]<br>
[/showif]


= [ListWords Words=3D[url][message_Clean][/url]&Delimiters=3D|]




[showif [index]=3D2]
=A0=A0=A0 [text]url_link=3D[convertch= ars table=3DJSON_ConvertLink][word][/convertchars][/text]
[/showif]

[showif [index]=3D4]
=A0=A0=A0 [text]url_title=3D[unurl= ][word][/unurl][/text]
[/showif]

[showif [index]=3D6]
=A0=A0= =A0 [text]meta-keywords=3D[convertchars table=3DJSON_Convert][word][/conver= tchars][/text]
[/showif]

[showif [index]=3D8]
=A0=A0=A0 [text]url_description=3D[convertchars= table=3DJSON_Convert][word][/convertchars][/text]
[/showif]


=

[/listwords]

[showif [showOutPut]=3D1]
=A0=A0=A0 <stro= ng>url_link</strong>: [url_link]<br>
=A0=A0=A0 --<br>
=A0=A0=A0 <strong>url_title</strong>:= [url_title]<br>
=A0=A0=A0 --<br>
=A0=A0=A0 <strong>= ;meta-keywords</strong>: [meta-keywords]<br>
=A0=A0=A0 --<= ;br>
=A0=A0=A0 <strong>url_description</strong>: [url_des= cription]<br>
=A0=A0=A0 -----------------<br>
[/showif]
--089e0115fd3e24d05304edc9e364-- David Bastedo

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

WebCatalog for Postcards ? (1997) help with duplicate records posted (1998) Checking for pre-existing passwords (1998) Error Lob.db records error message not name (1997) authorizenet and netscape (2002) WebCatalog/Mac 2.1b2 New Features (1997) BBEdit WedDNA Codeless Language Module (2004) question: back button prevention (1997) Processing all html files through WebCat or Typhoon (1998) help on brickwalls (2003) searchable list archive (1997) Undeliverable Mail (1997) two of the same named db's open at once (1998) My server admin needs help ... (2004) Re:Emailer and encryption (1997) Comments in db? (1997) New Command prefs ... (1997) RE: incrementing a counter remotely? (1999) email preferences on NT (1997) removing programming logic white space (2003)