<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SERGIO ROJAS</title>
    <description>The latest articles on DEV Community by SERGIO ROJAS (@sarl23).</description>
    <link>https://dev.to/sarl23</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F32228%2F8a43cc38-5ef6-47b3-bcfc-a31b42d5363c.jpg</url>
      <title>DEV Community: SERGIO ROJAS</title>
      <link>https://dev.to/sarl23</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sarl23"/>
    <language>en</language>
    <item>
      <title>Web Scraping Herramientas y Técnicas para No bloquearte en el paso</title>
      <dc:creator>SERGIO ROJAS</dc:creator>
      <pubDate>Mon, 30 Oct 2023 01:34:38 +0000</pubDate>
      <link>https://dev.to/sarl23/web-scraping-en-python-herramientas-y-tecnicas-para-recopilar-datos-en-la-web-2daa</link>
      <guid>https://dev.to/sarl23/web-scraping-en-python-herramientas-y-tecnicas-para-recopilar-datos-en-la-web-2daa</guid>
      <description>&lt;p&gt;El mundo del desarrollo web es un viaje en constante evolución, y en mi propia travesía decidí dar un giro inesperado. Siendo un desarrollador Front-end apasionado por el diseño web, me aventuré a dar un salto hacia el desarrollo Back-end.&lt;/p&gt;

&lt;p&gt;Esta transición no solo amplió mis horizontes, sino que también me permitió explorar una herramienta fascinante: el web scraping.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.memecreator.org%2Fstatic%2Fimages%2Fmemes%2F5329011.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fwww.memecreator.org%2Fstatic%2Fimages%2Fmemes%2F5329011.jpg" title="Título opcional" alt="Texto alternativo" width="375" height="327"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;En este artículo, compartiré mi experiencia y algunas de las lecciones aprendidas que me ayudaron a superar el desafío de cambiar mi enfoque de desarrollo y sumergirme en este mundo del web scraping. Posiblemente desarrolle un proyecto más complejo en el futuro donde se demuestre de manera práctica el desarrollo y los usos de Selenium en web scraping.&lt;/p&gt;

&lt;p&gt;Inicialmente, partí investigando casos expuestos en la red sobre web scraping, incluyendo las mejores herramientas y los escenarios en los que se pueden aplicar. Esto me ayudó a seleccionar Python como lenguaje de programación inicial para comenzar con el desarrollo, permitiéndome obtener, manipular y usar los datos generados mediante web scraping.&lt;/p&gt;

&lt;p&gt;Te recomiendo investigar cómo realizar web scraping en la página que tengas en mente. Es posible que puedas obtener la información usando &lt;strong&gt;Beautiful Soup&lt;/strong&gt; o &lt;strong&gt;Selenium&lt;/strong&gt;. Para páginas donde la información está cargada de forma dinámica, se recomienda el uso de Selenium.&lt;/p&gt;

&lt;p&gt;La diferencia principal radica en cómo deseas obtener los datos de la página. &lt;strong&gt;Beautiful Soup&lt;/strong&gt; realiza una especie de captura de pantalla del DOM en el momento, mientras que Selenium permite interacciones más dinámicas.&lt;/p&gt;

&lt;p&gt;Para comenzar, descarga &lt;a href="https://www.selenium.dev/" rel="noopener noreferrer"&gt;Selenium&lt;/a&gt;, una herramienta de pruebas de software para aplicaciones web que permite extraer información de las páginas y realizar acciones dinámicas de forma automática:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;Selenium
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Es importante saber que necesitarás un driver para que Selenium interactúe con tu navegador. Aquí algunos de los drivers más populares:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://webkit.org/blog/6900/webdriver-support-in-safari-10/" rel="noopener noreferrer"&gt;Safari&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/mozilla/geckodriver/releases" rel="noopener noreferrer"&gt;Firefox&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://chromedriver.chromium.org/downloads" rel="noopener noreferrer"&gt;Chrome&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;En este caso, usaré Chrome como ejemplo, ya que al ser uno de los navegadores más utilizados, hay abundante información sobre su uso con Selenium. Luego, configura Selenium para acceder a una URL establecida y realizar web scraping:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;selenium&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;webdriver&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;selenium.webdriver.support.ui&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;WebDriverWait&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;selenium.webdriver.common.by&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;By&lt;/span&gt;

&lt;span class="c1"&gt;#Options
&lt;/span&gt;
&lt;span class="n"&gt;browser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;webdriver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Chrome&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;http://www.pagina_prueba_aqui.com&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;elem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find_element&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;By&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NAME&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;p&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Find the search box
&lt;/span&gt;&lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;quit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Para esta configuración, es esencial incluir herramientas como &lt;em&gt;WebDriverWait&lt;/em&gt;, que permite controlar el tiempo de carga de la página, y &lt;em&gt;By&lt;/em&gt;, que facilita la búsqueda de elementos HTML.&lt;/p&gt;

&lt;p&gt;Encontrarás numerosos artículos, blogs y videos con valiosa información para desarrollar proyectos que utilicen web scraping.&lt;/p&gt;

&lt;p&gt;El propósito de este artículo es ofrecerte orientación sobre posibles errores que podrías enfrentar durante tu desarrollo. Muchos de estos obstáculos me llevaron tiempo entender y resolver, por lo que compartiré mis soluciones para ayudarte a avanzar con éxito en tu proyecto.&lt;/p&gt;

&lt;p&gt;Uno de los errores más comunes es ignorar los tiempos de carga de información en una página web. Aunque estimes un intervalo de 5 segundos, no siempre es suficiente para que la información esté disponible. Es importante verificar la existencia de los elementos antes de extraerlos.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;delay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="c1"&gt;# seconds
&lt;/span&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;myTag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;WebDriverWait&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;until&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;EC&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;presence_of_element_located&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;By&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;id_element&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Page is ready!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="n"&gt;TimeoutException&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Loading took too much time!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Otro error frecuente es ignorar cambios dinámicos en el DOM. Estos pueden ocurrir después de una interacción, como un clic o un desplazamiento, haciendo que el scraper falle al intentar acceder a elementos que ya no existen o han cambiado de lugar.&lt;/p&gt;

&lt;p&gt;Por último, recuerda respetar los términos de servicio del sitio web objetivo para evitar problemas legales o el bloqueo de tu scraper.&lt;/p&gt;

&lt;p&gt;Próximamente exploraremos más errores y mejores prácticas para maximizar la eficiencia de tu scraper con Selenium.&lt;/p&gt;

&lt;p&gt;¡Mantente atento! 🚀&lt;/p&gt;

</description>
      <category>selenium</category>
      <category>automation</category>
      <category>developer</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to handle surprise changes within the project 😌🙌</title>
      <dc:creator>SERGIO ROJAS</dc:creator>
      <pubDate>Thu, 16 Apr 2020 03:42:11 +0000</pubDate>
      <link>https://dev.to/sarl23/how-to-handle-surprise-changes-within-the-project-2871</link>
      <guid>https://dev.to/sarl23/how-to-handle-surprise-changes-within-the-project-2871</guid>
      <description>&lt;p&gt;&lt;em&gt;Web development field has been growing over time, the community frequently contributes and strengthens new and early technological generations, each person, each taste is divided into back or front, each a fundamental part of the other, darkness and light as fundamental as the same existence.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you do front-end development, you must understand that the needs that are established by the design team are the most important to guarantee a correct, excellent and primordial user experience providing clear contents and designs that fit the requirements. This seems easy and as end users or consumers we usually categorize the pages depending on its design and web usability, which includes the ease with which a user navigates through a website; to achieve this you must build a simple, intuitive and fluid navigation. It is even possible to say that it is of little use to have a good design if the texts are very long or not very explanatory.&lt;/p&gt;

&lt;p&gt;For those who are independent developers, whose approach to the client is constant and who do not have any knowledge of the design or internal functioning of a website, &lt;strong&gt;do not despair&lt;/strong&gt;, they want both the project they commissioned and their tastes to be reflected in the website they want. The changes they will ask you for as the project develops will increase, some changes will be simple while others will be tedious and unnecessary, &lt;em&gt;in these cases patience will be a great companion&lt;/em&gt;, try to mitigate, if not eliminate, the discussions that arise from changes in functionality and design, either by color, by position, by size, and so on. This type of changes will be present throughout the life cycle of the project.&lt;/p&gt;

&lt;p&gt;I can assure you that those moments will be very impertinent, but that is why must be clear from start to end, explaining to the client in a common way the steps that you are going to follow, the life cycle that you will carry in the project, showing him periodic progress and letting them know what you are going to develop after showing what you already achieved. It is important to establish documents where you specify how you will design the page (look and feel) so the client knows how it will look at the end, that way, your process will be very comfortable. Do not be impatient, at the beginning this can be annoying, but it will help you build a skill that will increase your professional capacity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Go for it!😉
&lt;/h2&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
