Advertisement
Guest User

xpostsub

a guest
Oct 18th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.65 KB | None | 0 0
  1. #!/usr/bin/python
  2. import praw
  3. from urllib.parse import quote_plus
  4.  
  5. # Goal: To Create a bot that posts the sub from where an there has been an x-post
  6.  
  7. def Bot_Login():
  8. bot = praw.Reddit(user_agent='XPostBot',
  9. client_id='',
  10. client_secret='',
  11. username='XPostBot',
  12. password='')
  13. return bot
  14.  
  15.  
  16. def run(runfile):
  17. with open(runfile,"r") as rnf:
  18. exec(rnf.read())
  19.  
  20. bot = Bot_Login()
  21. # Login Complete
  22.  
  23.  
  24. BotHate = ['youtubehaiku','ynab','xadnem_bots','wwii','wtf','wsgy','woweconomy','worldpowers','worldnews','worldbuilding'
  25. ,'winnipeg','windows10','windows','wicked_edge','whowouldwin','whatisthisthing','weightroom','weddingplanning',
  26. 'web_design','watches','warthunder','vive','videos','vegan','vainglorygame','unresolvedmysteries'
  27. ,'ula','uberdrivers','twoxchromosomes','twitch','trumpcriticizestrump','tropicalweather','travelingsinglet',
  28. 'trashy','transpassing','trackers','totalwar','toontownrewritten','todayilearned','tipofmytongue',
  29. 'tinytrumps','tinder','tifu','thisismylifenow','thewallstreet','thesilphroad','thenetherlands',
  30. 'thelastofus','thecryopodtohell','thebluepill','the_donald','thathappened','texasrangers','terracehouse',
  31. 'television','tekken','teenmomogandteenmom2','tattoos','tampa','talesoftherays','talesfromtechsupport',
  32. 'talesfromretail','tagpro','sysadmin','synthesizers','sweden','svenskpolitik','survivor','supernatural',
  33. 'summonerswar','subredditdrama','stims','stepparents','steelseries','startrek','stardustcrusaders',
  34. 'splatoon','soylent','socialism','soccer','sjwhate','shitamericanssay','shadowverse','science','sandiego',
  35. 'running','roosterteeth','romania','rollercoasters','rit','retconned','relationships','relationship_advice',
  36. 'rct','random_acts_of_amazon','raisedbynarcissists','rage','pussypassdenied','protectandserve','proed','portland',
  37. 'popheads','politics','politicalhumor','polandball','podcasts','playrust','playark','pics','photoshopbattles','philosophy',
  38. 'philippines','personalfinance','perfecttiming','peloton','pcmasterrace','pcgaming','pathofexile','paladins','owconsole',
  39. 'overwatch','osugame','osha','onepunchman','oakland','nyjets','nostupidquestions','nfl','nexus6p','nexus5x','newzealand',
  40. 'newtubers','news','networking','netflix','neoliberal','nba','naruto','music','muse','muacjdiscussion','moviedetails','motorcycles',
  41. 'mma','minecraft','milliondollarextreme','mechmarket','mechanicalkeyboards','me_irl','mariners',
  42. 'malefashionadvice','makeupaddiction','magicthecirclejerking','magictcg','maddenultimateteam','loseit',
  43. 'listentothis','legaladvice','learnpython','learnjapanese','leagueoflegends','lawschool','latestagecapitalism',
  44. 'lateshow','kotor','kotakuinaction','korean','kirby','killingfloor','judaism','jokes','japantravel',
  45. 'jaguars','iwatchedanoldmovie','intj','infinitewarfare','indiainvestments','inceltears','imagesofthe2010s',
  46. 'im14andthisisdeep','humansbeingbros','homestuck','hockey','hmmm','history','hiphopheads','hfy','heroesofthestorm',
  47. 'hearthstone','healthyfood','hardstyle','halo','haggardgarage','gwent','guns','gundeals',
  48. 'guitarpedals','guildwars2','griptraining','greenday','greenbaypackers','googlepixel','globaloffensivetrade',
  49. 'globaloffensive','gifs','getmotivated','gaybroscirclejerk','gaming','games','gamerghazi','gameofthrones',
  50. 'futurology','futuramawotgame','funny','ftm','frisson','forwardsfromgrandma','formula1','food',
  51. 'fivenightsatfreddys','fitness','fireteams','fireemblem','finalfantasy','ffbraveexvius','femalefashionadvice',
  52. 'fcbayern','fatlogic','fastfood','fantasyfootball','fantasy','fallout','explainlikeimfive','exmormon',
  53. 'eve','europe','eu4','enough_sanders_spam','emulation','elitedangerous','elderscrollsonline','dragonage',
  54. 'dota2','dnb','diy','dirtypenpals','destinythegamecss','destinythegame','denver','de','dbz',
  55. 'daystrominstitute','datingoverthirty','dating','dataisbeautiful','dancemoms','cynicalbrit','criticalrole',
  56. 'cricket','credibledefense','crappydesign','conlangs','competitiveoverwatch','comedycemetery','colts',
  57. 'colinslaststand','codzombies','cinema4d','choosingbeggars','charlotte','characterrant','changemyview',
  58. 'cfbofftopic','cfb','ccw','cattaps','casualuk','casualconversation','cars','cardinals','cannabisextracts',
  59. 'canadapolitics','canada','california','budgetaudiophile','browns','brewers','breakingmom','bravefrontier',
  60. 'boston','boombeach','books','boardgames','bleachbravesouls','blackpeopletwitter','blackops3'
  61. ,'bitcoin','bigbrother','bicycling','bestoflegaladvice','bestof','belgium','beerporn','beautyindustrychatter'
  62. ,'beautyguruchatter','battlestations','battlefield_live','battlefield_comp','baseball','barca','aww',
  63. 'austria','australia','asoiaf','askwomen','askuk','askthe_donald','askscience','askreddit','askhistorians',
  64. 'askeurope','askaliberal','asianbeautyadvice','army','argentina','ar15','answers','anime','animalcollective',
  65. 'androidgaming','androidapps','android','amateurradio','afl','adviceanimals','advice','acne','3dshacks','in']
  66.  
  67. xpost = ['x-post', 'x post', 'x/post', 'xpost']
  68.  
  69. # Entered r/all & Checking All New Posts
  70. subreddit = bot.subreddit('all')
  71. for comment in reddit.subreddit('all').stream.submissions():
  72. if comment.subreddit.display_name not in BotHate.BotHate:
  73.  
  74.  
  75. # Checking For x-post
  76. normalized_title = submission.title.lower()
  77. for xpost_phrase in xpost:
  78. if xpost_phrase in normalized_title:
  79. reply_template = 'Here is the Sub X-Posted From: {}'
  80. url_title = quote_plus(submission.title)
  81. reply_text = reply_template.format(url_title)
  82. submission.reply(reply_text)
  83. break
  84.  
  85.  
  86. if __name__ == '__main__':
  87. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement