Last active
July 5, 2021 10:10
-
-
Save tg12/6344365e85f3d27d0f95fe906ec6a0ef to your computer and use it in GitHub Desktop.
Revisions
-
tg12 revised this gist
Jun 16, 2019 . 1 changed file with 0 additions and 15 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,3 @@ import time import praw import sqlite3 -
tg12 created this gist
Jun 15, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,100 @@ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND # NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE # DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, # WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # Dont forget to tip your server! # Bitcoin Cash (BCH) qpz32c4lg7x7lnk9jg6qg7s4uavdce89myax5v5nuk # Ether (ETH) - 0x843d3DEC2A4705BD4f45F674F641cE2D0022c9FB # Litecoin (LTC) - Lfk5y4F7KZa9oRxpazETwjQnHszEPvqPvu # Bitcoin (BTC) - 34L8qWiQyKr8k4TnHDacfjbaSqQASbBtTd import time import praw import sqlite3 from random import randint from time import sleep # FROMSUB = "cyber" # The subreddit you want to take posts from # TOSUBS = ["cyber_security", "cyberlaws", "security", "privacy", # "netsec", "technology", "computerforensics", "ComputerSecurity"] # The # subreddits you want to post to FROMSUB = "brexit" # The subreddit you want to take posts from TOSUBS = ["ukpolitics", "unitedkingdom"] # The subreddits you want to post to r = praw.Reddit(client_id='', client_secret='', password='', user_agent="test2v_0.1", username='') print("Logged in as: " + str(r.user.me())) conn = sqlite3.connect('saved.db') c = conn.cursor() c.execute('CREATE TABLE IF NOT EXISTS posts (id text)') def alreadyExists(post): for thing in c.execute( '''SELECT * FROM posts WHERE id = '{}' '''.format(post.id)): return True return False def addPost(post): c.execute('''INSERT INTO posts VALUES ('{}') '''.format(post.id)) def generateSelftext(post): if post.selftext == '': return None else: return post.selftext def generateLink(post): if post.selftext == '': return post.url else: return None def isPost(post): try: post.title return True except BaseException: return False def run(): for post in [post for post in r.subreddit(FROMSUB).new( limit=20) if not alreadyExists(post) and isPost(post)]: for each in TOSUBS: print("[-]debug, " + str(each)) try: print('Added post {}'.format(post.title)) r.subreddit(each).submit( post.title + ' (x-post from /r/{})'.format(FROMSUB), url='https://www.reddit.com' + post.permalink, resubmit=True, send_replies=True) except BaseException as e: print(e) sleep(randint(540, 900)) pass addPost(post) while True: run() conn.commit()