# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3 (ipykernel)
#     language: python
#     name: python3
# ---

# # CNPJ
# Brazillian companies public information data extraction.

# http://pytzen.org

import pandas as pd
from bs4 import BeautifulSoup
import requests

path = (
    'https://www.gov.br/receitafederal/pt-br/assuntos/' +
    'orientacao-tributaria/cadastros/consultas/dados-publicos-cnpj'
)
html_doc = requests.get(path).text
soup = BeautifulSoup(html_doc, 'html.parser')
list_link = soup.find_all('a')
list_link = [link.get('href') for link in list_link]
list_link = [link for link in list_link if '.zip' in link]
list_link = [link for link in list_link if 'anual' not in link]
list_link

for link in list_link:
    # ! wget {link} -P ../../data/cnpj/

# ## References
#
# https://www.crummy.com/software/BeautifulSoup/bs4/doc/
#
# https://pypi.org/project/requests/



StarcoderdataJupyterScriptsDedupFiltered