GNU/Linux >> Tutoriales Linux >  >> Linux

¿Cómo convertir HTML a texto?

No creo que curl tenga un procesador HTML incorporado. Sin embargo:

lynx --dump <URL>

hace el truco.

Si aún desea usar curl, puede usar html2text (disponible en Ubuntu).


Puedes instalar html2text (un convertidor avanzado de HTML a texto) y el uso es sencillo:

$ html2text http://example.com/
$ cat file.html | html2text -o file.txt

Instalar por:

  • Linux:apt-get install html2text
  • OS X:brew install html2text

Ejemplo con curl :

$ curl -sL google.com | html2text
Search Images Maps Play YouTube News Gmail Drive More ?
Web History | Settings | Sign in
     A better way to browse the web
       Get Google Chrome

          Advanced search Language tools

        [Google Search][I'm Feeling Lucky]

     Advertising Programmes Business Solutions+GoogleAbout GoogleGoogle.com
                           ? 2016 - Privacy - Terms

Linux
  1. Cómo convertir archivos de texto a mayúsculas o minúsculas

  2. Cómo convertir PDF a texto en Linux (GUI y línea de comandos)

  3. ¿Cómo convertir la salida de shell de Linux a HTML?

  4. ¿Cómo agrego texto a un archivo?

  5. Convertir imagen a texto

Cómo convertir un archivo de Windows a un archivo UNIX

Cómo convertir formatos de archivo con Pandoc en Linux [Guía rápida]

Cómo convertir una página web a PDF en Linux

Cómo convertir un documento de texto a voz en Ubuntu usando eSpeak

¿Cómo obtener el texto de una página usando wget sin html?

¿Cómo puedo convertir datos de texto de dos valores a binario (representación de bits)?