Last active
June 29, 2023 10:42
-
-
Save AlgorithmAlchemy/d21497ca2891317d6e9dd75639d1943d to your computer and use it in GitHub Desktop.
Simple instagram fridnd local parser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
# Открываем HTML-файл | |
with open('file.html', 'r', encoding='utf-8') as file: | |
html_content = file.read() | |
# Создаем объект BeautifulSoup для парсинга | |
soup = BeautifulSoup(html_content, 'html.parser') | |
# Находим все блоки <div> с определенным классом, содержащим имена "alerionn" | |
div_blocks = soup.find_all('div', class_='x9f619 xjbqb8w x1rg5ohu x168nmei x13lgxp2 x5pf9jr xo71vjh x1n2onr6 x1plvlek xryxfnj x1c4vz4f x2lah0s x1q0g3np xqjyukv x6s0dn4 x1oa3qoh x1nhvcw1') | |
cnt = 0 | |
# Обрабатываем каждый блок и выводим содержимое | |
for div in div_blocks: | |
cnt +=1 | |
print(div.text) | |
print(cnt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment