A bot which will notifies you about:
- Any new reply to your post
- If anyone quotes you or mentions your username
- If any new topic or reply contains your keywords
It uses
pushbullet app(available on both iPhone and android), or
Telegram to send notifications.
Like this:
![](https://ip.bitcointalk.org/?u=https%3A%2F%2Fi.imgur.com%2FwQrwc3e.jpg&t=665&c=Wf1EWpkp3YdLEg)
Make sure to pip install these two libraries:
pushbullet.py
bs4
After installing these two libraries, copy/paste and run the code
Here is the code:
No need to edit anything in the script.
notifm=input("Choose notification method.\nEnter 1 for Telegram Bot\nEnter 2 for Pushbullet")
if (notifm=='2'):
token=input("Enter Token: ")
if (notifm=='1'):
btoken=input("Enter Bot Token: ")
chatid=input("Enter Your CHAT ID: ")
keywords=[]
topics=[]
cc='y'
vv=0
while cc=='y' or cc=='Y' or cc=='yes' or cc=='Yes' or cc=='YES':
vva=vv+1
vva=str(vva)
kw=input("Enter #"+vva+" Keyword/username(Just Press enter if no keyword) ")
keywords.insert(vv,kw)
vv+=1
cc=input("Add more keyword/username? y/n ")
vv=0
cc1='y'
while cc1=='y' or cc1=='Y' or cc1=='yes' or cc1=='Yes' or cc1=='YES':
vva=vv+1
vva=str(vva)
kw=input("Enter #"+vva+" Topic title(Just Press enter if none) ")
kw=kw.lstrip()
topics.insert(vv,kw)
vv+=1
cc1=input("Add more Topics? y/n ")
import requests
import re
from bs4 import BeautifulSoup
from datetime import datetime
from pushbullet import Pushbullet
from time import sleep
url="https://bitcointalk.org/index.php?action=recent"
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36'}
if (notifm=='2'):
pb= Pushbullet(token)
done=[]
i=0
key=0
print('Working..')
while True:
page = requests.get(url, headers=headers)
soup=BeautifulSoup(page.content, 'html.parser')
if topics[0] != "":
for s in topics:
s='Re: '+s
for a in soup.findAll('a', text=s):
if not a.get('href') in done:
done.insert(i,a.get('href'))
i+=1
ptitle='New Reply on your topic'
ptext='Link: '+a.get('href')
if(notifm=='2'):
push = pb.push_note(ptitle,ptext)
if(notifm=='1'):
push = "https://api.telegram.org/bot"+btoken+"/sendMessage?chat_id="+chatid+"&text="+ptitle+" "+ptext
requests.get(push, headers=headers)
print('New topic found, sending message')
sleep(300)
if keywords[0] != "":
for x in keywords:
table=soup.find_all('table',attrs={'class':'bordercolor'})
for t in table:
results=t.find(string=re.compile('.*{0}.*'.format(x)))
if results!=None:
s=t.find('b')
title=s.text
li=s.find('a')
if not li.get('href') in done:
done.insert(i,li.get('href'))
i+=1
ptext='Title: '+title+' Link:'+li.get('href')
ptitle='Post with keyword: *'+x+'* Found'
if(notifm=='2'):
push = pb.push_note(ptitle,ptext)
if(notifm=='1'):
push = "https://api.telegram.org/bot"+btoken+"/sendMessage?chat_id="+chatid+"&text="+ptitle+" "+ptext
requests.get(push, headers=headers)
print("Keyword found, sending message")
sleep(300)
sleep(20)
You can find API token of your pushbullet account here:
https://www.pushbullet.com/#settings/accountIf you are using telegram as notification method instead of Pusbullet, you will need a Bot token ID and your CHAT ID.
Here's how to procure these two things:
1.)Use godfather to create a new bot and note down its
token ID. Make sure to send a /start message to that bot.
2.)Send a message to @RawDataBot, it will reply back with your
Chat ID. See pic
https://i.imgur.com/TsFUsFB.pngYou can install Termux on your phone, to run this script 24*7 by using termux-wake-lock (Haven't tested it yet but should work, it might drain your battery)
It's better to use the script on your PC, by installing python on it.
I will be adding a new update for sock usage, so that you can run it on a VPS. You won't be able to run this script on a VPS for now because cloudflare won't let a datacenter IP address to scrap recent pages.
Reply here, if you face any problem.