Advertisement
altChip

Bodged fxBuzzly

Feb 15th, 2022
1,041
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.03 KB | None | 0 0
  1. from flask import Flask, render_template
  2. import requests
  3.  
  4. buzzly_username = "othermiddy"
  5. buzzly_title = "montgomery"
  6.  
  7. app = Flask(__name__)
  8.  
  9. data = {
  10.     "operationName": "getSubmission",
  11.     "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",
  12.     "variables": {"username": f"{buzzly_username}", "slug": f"{buzzly_title}"},
  13. }
  14.  
  15.  
  16. @app.route("/<path:subpath>")
  17. def fx_buzzly_art(subpath):
  18.     global buzzly_title, buzzly_username
  19.     global data
  20.  
  21.     buzzly_title = subpath[0]
  22.     buzzly_username = subpath[2].replace("~", "")
  23.  
  24.     response = requests.post("https://graphql.buzzly.art/graphql", json=data)
  25.     origin = "https://buzzly.art/" + subpath
  26.  
  27.     return render_template(
  28.         "index.html",
  29.         user=response.json()["data"]["fetchSubmissionByUsernameAndSlug"]["submission"][
  30.             "account"
  31.         ]["displayName"]
  32.         + "("
  33.         + response.json()["data"]["fetchSubmissionByUsernameAndSlug"]["submission"][
  34.             "account"
  35.         ]["displayName"]
  36.         + ")",
  37.         img="https://submissions.buzzly.art"
  38.         + response.json()["data"]["fetchSubmissionByUsernameAndSlug"]["submission"][
  39.             "path"
  40.         ],
  41.         url=origin,
  42.         desc=response.json()["data"]["fetchSubmissionByUsernameAndSlug"]["submission"][
  43.             "description"
  44.         ],
  45.     )
  46.  
  47.  
  48. if __name__ == "__main__":
  49.     app.run(debug=True)
  50.     app.run(host="0.0.0.0", port=666)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement