Загрузить новый файл
This commit is contained in:
parent
5014cb3c41
commit
c8853eb1a5
26
soup/idioto.py
Normal file
26
soup/idioto.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import requests
|
||||||
|
from bs4 import BeautifulSoup # pip install bs4, pip install lxml
|
||||||
|
import re
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
url = 'ссылка для идиота'
|
||||||
|
response = requests.get(url)
|
||||||
|
soup = BeautifulSoup(response.text, 'lxml')
|
||||||
|
|
||||||
|
def string_cleanup(x, notwanted):
|
||||||
|
for item in notwanted:
|
||||||
|
x = re.sub(item, '', x)
|
||||||
|
return x
|
||||||
|
|
||||||
|
lol = (soup.get_text())
|
||||||
|
|
||||||
|
lol = lol.split()
|
||||||
|
|
||||||
|
lol = lol[0:3]
|
||||||
|
|
||||||
|
print(*lol)
|
||||||
|
|
||||||
|
|
||||||
|
os.system("notify-send 'ОЛО!' '" + str(lol) + "'")
|
Reference in a new issue