Bitcoin Forum
July 23, 2019, 04:01:31 AM *
News: Latest Bitcoin Core release: 0.18.0 [Torrent] (New!)
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Quote/Keyword/Reply/Topic Notifier  (Read 251 times)
edgycorner
Full Member
***
Offline Offline

Activity: 503
Merit: 224

ψkek


View Profile
May 24, 2019, 03:14:48 PM
Last edit: May 29, 2019, 07:48:08 PM by edgycorner
Merited by dbshck (5), elda34b (5), TryNinja (3), PryptoMontreal (3), Harlot (2), Halab (2), LeGaulois (1), stomachgrowls (1), Piggy (1), sncc (1), morvillz7z (1)
 #1

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), to send notifications.

Like this:


You can install pydroid3 on your phone, to run this script 24*7
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.

Code:

token=input("Enter Token: ")
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) ")
 topics.insert(vv,kw)
 vv+=1
 cc1=input("Add more keyword/username? 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'}

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')
       push = pb.push_note(ptitle,ptext)
       print('New topic found, sending message')
 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'
        push = pb.push_note(ptitle,ptext)
        print("Keyword found, sending message")
    
 sleep(2)



You can find API token of your account here:
https://www.pushbullet.com/#settings/account


Reply here, if you face any problem.

1563854491
Hero Member
*
Offline Offline

Posts: 1563854491

View Profile Personal Message (Offline)

Ignore
1563854491
Reply with quote  #2

1563854491
Report to moderator
1563854491
Hero Member
*
Offline Offline

Posts: 1563854491

View Profile Personal Message (Offline)

Ignore
1563854491
Reply with quote  #2

1563854491
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1563854491
Hero Member
*
Offline Offline

Posts: 1563854491

View Profile Personal Message (Offline)

Ignore
1563854491
Reply with quote  #2

1563854491
Report to moderator
TryNinja
Legendary
*
Offline Offline

Activity: 1078
Merit: 1373


CS <3


View Profile
May 24, 2019, 04:00:47 PM
Merited by edgycorner (3)
 #2

Great Job! I actually prefer Pushbullet over Telegram (which most people use).

Could you add an option to scrape posts in the “recent” page? That would allow to search for keywords direclty on posts instead of just thread titles.

edgycorner
Full Member
***
Offline Offline

Activity: 503
Merit: 224

ψkek


View Profile
May 24, 2019, 06:44:46 PM
 #3

Great Job! I actually prefer Pushbullet over Telegram (which most people use).
And People won't be comfortable to use their bots key on someone else's script, if they don't know programming.

Could you add an option to scrape posts in the “recent” page? That would allow to search for keywords direclty on posts instead of just thread titles.
Very good suggestion, I didn't even think about it.Will add it someday, for sure.
ETFbitcoin
Legendary
*
Offline Offline

Activity: 1708
Merit: 1872

Use SegWit and enjoy lower fees.


View Profile WWW
May 24, 2019, 07:18:38 PM
 #4

Nice job! But looks like it requires users need computer/server which run 24/7 if you need continuous notification, right?

I wonder if the script would run on QPython3/Pydroid 3 out-of-the-box?

TryNinja
Legendary
*
Offline Offline

Activity: 1078
Merit: 1373


CS <3


View Profile
May 24, 2019, 07:29:01 PM
 #5

Nice job! But looks like it requires users need computer/server which run 24/7 if you need continuous notification, right?

I wonder if the script would run on QPython3/Pydroid 3 out-of-the-box?
I’m not sure if it would work, but you can try “hosting” your python script with PythonAnywhere[1]. It’s free and you can make the script work without having your PC on all day.

[1] https://www.pythonanywhere.com/

edgycorner
Full Member
***
Offline Offline

Activity: 503
Merit: 224

ψkek


View Profile
May 25, 2019, 12:08:22 PM
 #6

Unfortunately, pythonanywhere has blacklisted bitcointalk.

Nice job! But looks like it requires users need computer/server which run 24/7 if you need continuous notification, right?

I wonder if the script would run on QPython3/Pydroid 3 out-of-the-box?
It worked with Pydroid 3, just make sure to pip install bs4 and pushbullet.py
edgycorner
Full Member
***
Offline Offline

Activity: 503
Merit: 224

ψkek


View Profile
May 29, 2019, 07:20:00 PM
Last edit: May 29, 2019, 08:02:34 PM by edgycorner
 #7

The bot has been updated.

Updates:

  • Anyone can use the script, even with no knowledge about programming
  • The bot now checks recent posts section for updates
  • Notifies when your username is mentioned(or quoted) in any post
  • Pydrioid3 compatibility, to run the script 24*7 through your phone


You can PM me or reply here, if you are unable to run the script.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!