Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #HOW TO USE SOYSCRIPT.PY
- #The first argument will specify the board. The second argument will specify the thread.
- #This will automatically generate a random soyspam for you to post in the thread.
- #The generated soyspam will be saved to soyspam.txt.
- #You can probably modify this to make it work for other chans.
- import sys
- import os
- import requests
- import json
- import re
- from random import shuffle
- import w3lib.html
- r = requests.get('https://a.4cdn.org/'+sys.argv[1]+'/thread/'+sys.argv[2]+'.json')
- r = r.json()
- posts = []
- charrep = [
- ("\n","\n>"),
- ("'","'"),
- ("\","\\"),
- (">",">"),
- (""","\""),
- ("<","<"),
- (" "," "),
- ("¢","¢"),
- ("£","£"),
- ("¥","¥"),
- ("€","€"),
- ("©","©"),
- ("®","®"),
- ("&","&")
- ]
- for p in r['posts']:
- try:
- com = p['com']
- if com.count('>') > 16:
- continue
- com = com.replace('<br>','\n')
- com = w3lib.html.remove_tags(com)
- #com = replace_entities(com)
- for r in charrep:
- com = com.replace(r[0],r[1])
- com = ">>"+str(p['no'])+"\n>"+com
- posts.append(com)
- except:
- continue
- outtxt = ""
- shuffle(posts)
- for p in posts:
- tempouttxt = outtxt + p + "\n\n"
- if len(tempouttxt) > 1999:
- continue
- elif tempouttxt.count("\n") > 99:
- continue
- else:
- outtxt = tempouttxt
- out = open("soyspam.txt","w")
- out.write(outtxt)
- out.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement