Foro de elhacker.net

Programación => Desarrollo Web => Mensaje iniciado por: Esgrimidor en 12 Septiembre 2017, 13:34 pm



Título: Convertir manualmente partes de un archivo html a csv
Publicado por: Esgrimidor en 12 Septiembre 2017, 13:34 pm
Tengo un html de dictionary.com con palabras inglesas y su significado.

No en formato tabla.

El asunto es que no se cómo convertir cada palabra y su significado al formato csv manteniendo, en lo posible, las etiquetas de formato del html original.

Adjunto parte del código del html con algunas palabras de diccionario.
Si me indicas cómo puedo procesar la primera , ya el resto me será fácil.
Gracias


Código:
        <div class="def-list">
                                        <section class="def-pbk ce-spot" data-collapse-expand='{"target": ".def-set", "type": "def"}'>
                    <header class="luna-data-header">
                        <span class="dbox-pg">adjective</span>, <span class="dbox-bold" data-syllable="big·ger, ">bigger, </span><span class="dbox-bold" data-syllable="big·gest.">biggest.</span>                    </header>

                                           
<div class="def-set">
    <span class="def-number">1.</span>
    <div class="def-content">
        large, as in size, height, width, or amount:                 <div class="def-block def-inline-example"><span class="dbox-example">a big house; a big quantity.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">2.</span>
    <div class="def-content">
        of major concern, importance, gravity, or the like:                 <div class="def-block def-inline-example"><span class="dbox-example">a big problem.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">3.</span>
    <div class="def-content">
        outstanding for a specified quality:                 <div class="def-block def-inline-example"><span class="dbox-example">a big liar; a big success.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">4.</span>
    <div class="def-content">
        important, as in influence, standing, or wealth:                 <div class="def-block def-inline-example"><span class="dbox-example">a big man in his field.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">5.</span>
    <div class="def-content">
        grown-up; mature:                 <div class="def-block def-inline-example"><span class="dbox-example">big enough to know better.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">6.</span>
    <div class="def-content">
        elder:                 <div class="def-block def-inline-example"><span class="dbox-example">my big sister.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">7.</span>
    <div class="def-content">
        doing business or conducted on a large scale; major in size or importance:                 <div class="def-block def-inline-example"><span class="dbox-example">big government.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">8.</span>
    <div class="def-content">
        consisting of the largest or most influential companies in an industry:                 <div class="def-block def-inline-example"><span class="dbox-example">Big steel wants to lower prices, but the smaller mills don't.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">9.</span>
    <div class="def-content">
        <span class="dbox-italic">Informal. </span>known or used widely; popular:                 <div class="def-block def-inline-example"><span class="dbox-example">Nouvelle cuisine became big in the 1970s.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">10.</span>
    <div class="def-content">
        magnanimous; generous; kindly:                 <div class="def-block def-inline-example"><span class="dbox-example">big enough to forgive.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">11.</span>
    <div class="def-content">
        boastful; pompous; pretentious; haughty:                 <div class="def-block def-inline-example"><span class="dbox-example">a big talker.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">12.</span>
    <div class="def-content">
        loud; orotund:                 <div class="def-block def-inline-example"><span class="dbox-example">a big voice.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">13.</span>
    <div class="def-content">
        (of clothing or a clothing design) made of or distinguished by voluminous fabric that is loosely or softly shaped and fitted:                 <div class="def-block def-inline-example"><span class="dbox-example">a big shirt; the big look.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">14.</span>
    <div class="def-content">
        (of a wine) having more than average flavor, body, and alcoholic content.    </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">15.</span>
    <div class="def-content">
        filled; brimming:                 <div class="def-block def-inline-example"><span class="dbox-example">eyes big with tears.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">16.</span>
    <div class="def-content">
        <span class="dbox-italic">Chiefly South Midland and Southern U.S. </span><a class="dbox-xref dbox-roman" href="http://www.dictionary.com/browse/pregnant">pregnant</a>.     </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">17.</span>
    <div class="def-content">
        <span class="dbox-italic">Obsolete. </span>very strong; powerful.    </div>
</div>
                                    </section>
                            <section class="def-pbk ce-spot" data-collapse-expand='{"target": ".def-set", "type": "def"}'>
                    <header class="luna-data-header">
                        <span class="dbox-pg">adverb</span>                    </header>

                                           
<div class="def-set">
    <span class="def-number">18.</span>
    <div class="def-content">
        <span class="dbox-italic">Informal. </span>boastfully; pretentiously:                 <div class="def-block def-inline-example"><span class="dbox-example">to act big; to talk big.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">19.</span>
    <div class="def-content">
        <span class="dbox-italic">Informal. </span>with great success; successfully:                 <div class="def-block def-inline-example"><span class="dbox-example">to go over big.</span></div>
                </div>
</div>
                                    </section>
                            <section class="def-pbk ce-spot" data-collapse-expand='{"target": ".def-set", "type": "def"}'>
                    <header class="luna-data-header">
                        <span class="dbox-pg">noun</span>                    </header>

                                           
<div class="def-set">
    <span class="def-number">20.</span>
    <div class="def-content">
        <span class="dbox-bold">the bigs, </span><span class="dbox-italic">Sports Slang. </span>the highest level of professional competition, as the major leagues in baseball.    </div>
</div>
                                    </section>
                            <section class="def-pbk ce-spot" data-collapse-expand='{"target": ".def-set", "type": "def"}'>
                    <header class="luna-data-header">
                        <span class="dbox-pg">Idioms</span>                    </header>

                                           
<div class="def-set">
    <span class="def-number">21.</span>
    <div class="def-content">
        <span class="dbox-bold">be big on, </span>to have a special liking or enthusiasm for:                 <div class="def-block def-inline-example"><span class="dbox-example">Mother is big on family get-togethers.</span></div>
                </div>
</div>
                                           
<div class="def-set">
    <span class="def-number">22.</span>
    <div class="def-content">
        <span class="dbox-bold">big with child. </span><a class="dbox-xref dbox-roman" href="http://www.dictionary.com/browse/great">great</a> (def 23).     </div>
</div>
                                    </section>
                    </div>

        <div class="tail-wrapper">


Título: Re: Convertir manualmente partes de un archivo html a csv
Publicado por: engel lex en 12 Septiembre 2017, 13:45 pm
Es más fácil que lo abras en el navegador, copias y pegas en excel y guardas como csv

No entiendo lo de
Citar
manteniendo, en lo posible, las etiquetas de formato del html


Título: Re: Convertir manualmente partes de un archivo html a csv
Publicado por: Esgrimidor en 13 Septiembre 2017, 16:57 pm
Es más fácil que lo abras en el navegador, copias y pegas en excel y guardas como csv

No entiendo lo de

Al final quiero que los valores vayan a los campos de Anki , Anverso y reverso.
Si se respeta una negrilla, una indentación, etc; pues resultará en destino más fácil leerlo.

si la solución es la que aportas entonces es más ventajoso el copy/paste directamente en los campos de la base Anki , programa de memorización por repeticion espaciada.