<?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: Emerson Fernandes</title>
    <description>The latest articles on DEV Community by Emerson Fernandes (@fernandesemes).</description>
    <link>https://dev.to/fernandesemes</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1139843%2F9a6fa8bb-2987-4b00-ba2b-1c9ba9f7135e.jpg</url>
      <title>DEV Community: Emerson Fernandes</title>
      <link>https://dev.to/fernandesemes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fernandesemes"/>
    <language>en</language>
    <item>
      <title>scraping all airconditioned from the free market sales site</title>
      <dc:creator>Emerson Fernandes</dc:creator>
      <pubDate>Sat, 26 Aug 2023 00:08:39 +0000</pubDate>
      <link>https://dev.to/fernandesemes/scraping-all-airconditioned-from-the-free-market-sales-site-45lk</link>
      <guid>https://dev.to/fernandesemes/scraping-all-airconditioned-from-the-free-market-sales-site-45lk</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from bs4 import BeautifulSoup
import requests
from time import sleep
import csv
import re
import math

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
    }

response = requests.get("https://lista.mercadolivre.com.br/ar-condicionado#D[A:ar%20condicionado]", headers=headers)
soup = BeautifulSoup(response.content, "html.parser")

items = soup.find('span', class_='ui-search-search-result__quantity-results shops-custom-secondary-font').get_text()
itemsI = items.find(' ')
items = items[:itemsI]
items = items.replace('.','')
items = math.ceil(int(items)/50)
index = 1



dictItems = {'Title':[], 'Price':[], 'Link':[]}


for i in range(1, items+1):
    nextPage = f'https://lista.mercadolivre.com.br/eletrodomesticos/ar-ventilacao/ar-condicionado/ar-condicionado_Desde_{index}_NoIndex_True'
    response = requests.get(nextPage, headers=headers)
    soup = BeautifulSoup(response.content, "html.parser")
    ar = soup.find_all('li', class_=re.compile('ui-search-layout__item shops__layout-item'))

    for i in ar:
        name = i.find('h2', class_=re.compile('ui-search-item__title shops__item-title')).get_text()
        price = i.find('span', class_=re.compile('andes-money-amount__fraction')).get_text()
        urls = i.find('a')['href']
        dictItems['Title'].append(name)
        dictItems['Price'].append(price)
        dictItems['Link'].append(urls.get('href'))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webscraping</category>
      <category>python</category>
    </item>
  </channel>
</rss>
