Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from flask import Flask, render_template
- import requests
- buzzly_username = "othermiddy"
- buzzly_title = "montgomery"
- app = Flask(__name__)
- data = {
- "operationName": "getSubmission",
- "query": "mutation getSubmission($username: String!, $slug: String!) {\n fetchSubmissionByUsernameAndSlug(input: {username: $username, slug: $slug}) {\n submission {\n ...fullSubmission\n }\n }\n}\n\nfragment fullSubmission on Submission {\n id\n title\n description\n tags\n path\n thumbnailPath\n type\n size\n created\n deleted\n visits\n width\n height\n slug\n comments\n ratings\n favorites\n textContent\n contentRating\n hiddenByStaff\n bucket: bucketByBucket {\n name\n }\n category: categoryByCategory {\n ...category\n }\n artSubjectCategories: submissionCategoriesBySubmissionId {\n nodes {\n category: categoryByCategoryId {\n ...category\n }\n }\n }\n account: accountByAccount {\n id\n displayName\n username\n profilePicturePath\n hideFromGuests\n bucket: bucketByBucket {\n name\n }\n user: userByUser {\n id\n isAdmin\n isStaff\n hideCountry\n premiumUntil\n bannedSince\n bannedUntil\n }\n }\n featuredOn\n featuredBy: accountByFeaturedBy {\n ...accountWithUser\n }\n}\n\nfragment category on Category {\n id\n name\n ordinal\n parent\n slug\n isArtSubject\n isNsfw\n}\n\nfragment accountWithUser on Account {\n id\n displayName\n username\n created\n preference\n followers\n profilePicturePath\n profileHeaderPath\n commentsSignature\n bucket: bucketByBucket {\n name\n }\n user: userByUser {\n id\n country\n bannedSince\n bannedUntil\n premiumUntil\n isAdmin\n isStaff\n hideCountry\n }\n isBot\n lastOnline\n hideLastOnline\n hideFromGuests\n hideFollowersCount\n hideFromInvisibleUsers\n}\n",
- "variables": {"username": f"{buzzly_username}", "slug": f"{buzzly_title}"},
- }
- @app.route("/<path:subpath>")
- def fx_buzzly_art(subpath):
- global buzzly_title, buzzly_username
- global data
- buzzly_title = subpath[0]
- buzzly_username = subpath[2].replace("~", "")
- response = requests.post("https://graphql.buzzly.art/graphql", json=data)
- origin = "https://buzzly.art/" + subpath
- return render_template(
- "index.html",
- user=response.json()["data"]["fetchSubmissionByUsernameAndSlug"]["submission"][
- "account"
- ]["displayName"]
- + "("
- + response.json()["data"]["fetchSubmissionByUsernameAndSlug"]["submission"][
- "account"
- ]["displayName"]
- + ")",
- img="https://submissions.buzzly.art"
- + response.json()["data"]["fetchSubmissionByUsernameAndSlug"]["submission"][
- "path"
- ],
- url=origin,
- desc=response.json()["data"]["fetchSubmissionByUsernameAndSlug"]["submission"][
- "description"
- ],
- )
- if __name__ == "__main__":
- app.run(debug=True)
- app.run(host="0.0.0.0", port=666)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement