@Helixable/

ScrapeR

Python

thank to @cyandev, short url at redscrape.cf

fork
loading
Files
  • main.py
  • templates
  • bs.py
  • requirements.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from flask import Flask,request,render_template
app = Flask('app')
import bs
from os import system
@app.route('/')
def hello_world():
  bs.start()
  return render_template("index.html")
@app.errorhandler(500)
def bad(e):
  return render_template('500.html'), 500
@app.route('/', methods=['POST'])
def my_form_post():
  if "subname" in request.form:
    subreddit=bs.postlisting(request.form["subname"])
    postlist, subname, commentnum, upvotelist, contentsList, imageList = subreddit
    length=len(postlist)
    #theme=request.form["theme"]
    return render_template("postlist.html", postlist=postlist, subname=subname, length=length, commentnum=commentnum, upvotelist=upvotelist, contentsList=contentsList,  imageList=imageList)
  elif "postnum" in request.form:
    content=bs.comments(int(request.form["postnum"]),str(request.form["sub"]))
    postname, filling, comments, authorlist, postauthor, upvotes, image, authcomm, postid, url, vidURL= content
    authcomm=dict(zip(authorlist, comments))
    return render_template("post.html", postname=postname, filling=filling, authcomm=authcomm, postauthor=postauthor, upvotes=upvotes, image=image, postid=postid, url=url, vidURL=vidURL)
#system("pkill -9 python")
app.run(host='0.0.0.0', port=8080, threaded=True)