From c59e1b5257017bcd785de681fddf911916c8dcfe Mon Sep 17 00:00:00 2001 From: ItachiUchiha1998 Date: Sat, 14 Oct 2017 00:11:50 +0530 Subject: [PATCH] news notifier for ndtv hindi site added --- News Notifier/news.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 News Notifier/news.py diff --git a/News Notifier/news.py b/News Notifier/news.py new file mode 100644 index 0000000..fac6862 --- /dev/null +++ b/News Notifier/news.py @@ -0,0 +1,19 @@ +import requests +import os +import sys +import urllib +from bs4 import BeautifulSoup +import notify2 +import time + +notify2.init("News") +url = "https://khabar.ndtv.com/topic/news/news" +r = requests.get(url) +soup = BeautifulSoup(r.content,"lxml") +news_data = soup.find_all("p",{"class":"intro"}) + +for item in news_data: + news = item.get_text().strip() + display = notify2.Notification(news) + display.show() + time.sleep(12)