Cool Dog Lyrics url:http://lib9.service.kugou.com/websearch/index.php?page=1&cmd=100&pagesize=9&keyword= + song name
Cool Dog Lyrics code: UTF-8
Chinese song name Turn UTF8 code
1 functionStrtohex (str:string; aencoding:tencoding):string;2 var3 Ss:tstringstream;4 I:integer;5 begin6Result: ="';7SS: =tstringstream.create (str, aencoding);8 Try9 forI: =0 toSs. Size-1 DoTenResult: = result +'%'+ Format ('%.2x', [SS. Bytes[i]]); One finally A SS. Free; - End; - End;
Strtohex (lyrics, Tencoding.utf8)
Tidhttp Calling code
1 functionHttpgetbystream (URL:string; aencoding:tencoding): Tstringstream;2 begin3 Try4Result: = Tstringstream.create ("', aencoding);5Fidhttp: = Tidhttp.create (Nil);6Fidhttp.connecttimeout: = the;7Fidhttp.readtimeout: =6000;8 Fidhttp.get (FURL, Result);9 finallyTen Fidhttp.disconnect; One Freeandnil (fidhttp); A End; - End; - the var - Restreambuff:tstringstream; - begin -//instantiates a string stream in Utf8 encoded format, +Restreambuff: = Tstringstream.create ("', Tencoding.utf8); - Try +Restreambuff: =Httpgetbystream (FURL, Tencoding.utf8); A// Dodatasting; at finally - Restreambuff.free; - End; - End;
The last parsed Restreambuff is a string stream, and its datastring is a JSON string
Using the system's own System.json class parsing can
First, cool dog lyrics search Indy tidhttp