/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
playwright__examples/parse_with_bs4.py
27 строк
678 B
gil9red
Added "playwright__examples/parse_with_bs4.py"
27 май 2025, 11:19
27 май 2025, 11:19
19fa48c
Код
Авторство
О чём код?
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "ipetrash" from bs4 import BeautifulSoup from playwright.sync_api import sync_playwright with sync_playwright() as p: browser = p.firefox.launch() page = browser.new_page() rs = page.goto("https://httpbin.org/") text = rs.text() browser.close() soup = BeautifulSoup(text, "html.parser") print(soup.select_one("a.github-corner")["href"]) print(soup.select_one(".description").get_text(strip=True, separator="\n")) """ https://github.com/requests/httpbin A simple HTTP Request & Response Service. Run locally: $ docker run -p 80:80 kennethreitz/httpbin """