Last active
February 27, 2022 17:59
-
-
Save ethmtrgt/1034a80c982c0c7361692f76bdf358e5 to your computer and use it in GitHub Desktop.
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
def get_news(update, context): | |
r = requests.get("https://www.haberler.com/son-dakika/") | |
soup = BeautifulSoup(r.content, "lxml") | |
news = soup.find_all('div', attrs={'class':"hblnBox"}) | |
for Kaynak in news[:1]: | |
Haber = Kaynak.find('span', attrs={'class':'hblnTitle'}) | |
_title_time = Haber.find('div', attrs={'class': 'hblnTitleTime'}) # İstenmeyen kısım | |
_title_time.extract() | |
img = Kaynak.find('img').get('src') | |
my_news = f"{Haber.text}\n{img}" | |
update.message.reply_text(my_news) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment