Hola de nuevo.
He estado probando a hacer lo que comentaba en el mensaje anterior (hacer salto de linea en cada ">"), puesto que el código fuente que obtengo viene de esta forma y no creo que sea adecuado para manipularlo en un TStringList:
Código:
<!DOCTYPE html><html><head><meta charset="utf-8" /><title>Well MP3 Download: FREE Music</title><meta name="description" content="well FREE Mp3 Download & well Songs. Download And Listen Top well Music, Songs & MP3s. Download well With MP3 search for Top Songs and Music." /><meta name="keywords" content="well mp3, well download, free music" /><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><meta name="author" content="MP3Juices" /><link rel="shortcut icon" type="image/x-icon" href="http://mp3juices.to/favicon.ico"><link rel="stylesheet" type="text/css" href="http://static.mp3juices.to/stylesheet.min.css" /><script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script><script type="text/javascript" src="http://static.mp3juices.to/scripts.js?wow=1"></script><script>(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,"script","//www.google-analytics.com/analytics.js","ga"); ga("create", "UA-43693247-1", "auto"); ga("send", "pageview"); </script></head><body><!-- Tag - Site-Under --><script async="true" src="//s.ad2387.com/script.js?i=876191"></script><!-- Tag - END --><!-- Tag - Top banner --><script async="true" src="//s.ad2387.com/script.js?i=876193"></script>
Y hasta ahora he conseguido esto:
Código Delphi
[-]
PageSource:= TStringList.Create; PageSource.LoadFromStream(LoadPage); LoadPage.Free;
for SourcePos:= Length(PageSource.Text) downto 0 do begin
if PageSource.Text[SourcePos] = '>' then PageSource.Insert(SourcePos + 1, #13 + #10); end;
Pero con esto me devuelve un error "List index () out of bounds"...
Si pruebo con PageSource.ToString me devuelve un error "Access Violation"
También he probado con el bucle for:
Código Delphi
[-]
for SourcePos:= 1 to Length(PageSource.Text) do
Pero obtengo los mismos errores.
La verdad no se si puede manipular un TStringList así y tampoco he encontrado ejemplos claros de como hacerlo.
¿Quizá debería cargar el código de otra forma?
Gracias por cualquier ayuda.
Saludos.