Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Found by watching requests from new.reddit.com actions in your browser F12 debug console
- import FYRAPI
- #Login
- r=FYRAPI.Reddit(username="SpambotSwatter",password="lolno")
- r._core.debug=True #print messages
- r.testlogin=None #speed up by not testing curent credentials
- #r=FYRAPI(None,None) #anonymous token... broken 23-08-17
- ################
- #################------ New.GQL API used by website
- ################
- #redditor Karma
- #print( r.GQL("db6eb1356b13",{"name":"SpambotSwatter"}) )
- #redditor Trophies
- #print( r.GQL("3c59e5ed6f14",{"profileName":"SpambotSwatter"}) )
- #chat unread indicators
- #print( r.GQL("051a1d7b8755") )
- #message and chat unread indicators
- #print( r.GQL("fbbc7389e1ff") )
- #Add a social link
- #print( r.GQL("5064afb1fbe2",{"input":{"socialLinks":[{"handle":"u/SpambotSwatter","type":"REDDIT"}]}}) )
- # {"input":{"socialLinks":[{"outboundUrl":"https://www.youtube.com/BigClive","title":"YouTube","type":"YOUTUBE"}]}}
- # {"input":{"socialLinks":[{"outboundUrl":"https://www.spamcop.net/","title":"Report SPAM EMail","type":"CUSTOM"}]}}
- #redditor SocialLinks
- print( r.GQL("11a239b07f86",{"username":"SpambotSwatter"}) )
- #Edit social link
- #print( r.GQL("c558e604581f",{"input":{"socialLinks":[{"outboundUrl":"https://spamcop.net/","title":"Report The SPAM","type":"CUSTOM","id":"f4defbdf-411f-47a3-b89e-c6f5e6faafa5"}]}}) )
- #Delete social link
- #print( r.GQL("7eb2600cd927",{"input":{"socialLinkIds":["f4defbdf-411f-47a3-b89e-c6f5e6faafa5"]}}) )
- #Self multireddits
- #print( r.GQL("b65f99b680f5",{"includeSources":True}) )
- #redditor multireddits
- #print( r.GQL("3d04e2bb92b5",{"name":"SpambotSwatter","first":3}) )
- #subscribed subreddits and users
- #print( r.GQL("ca83defc2e15",{"includeSources":True}) )
- #subscribed subreddits
- #print( r.GQL("775bcf2e4ca3",{"first":20}) )
- #Get special events
- #print( r.GQL("6c73f2f0b64f") )
- #Pull redditor posts, comments. website uses .json page for comment/overview but the filter here seems to work
- #print( r.GQL("e8d58a13151d",{"username":"SpambotSwatter","sort":"NEW"}) )
- #print( r.GQL("e8d58a13151d",{"username":"SpambotSwatter","sort":"NEW","filter":"POSTS"}) )
- #print( r.GQL("e8d58a13151d",{"username":"SpambotSwatter","sort":"NEW","filter":"COMMENTS"}) )
- #View modqueue, queueType MOD = Modqueue | REMOVED | REPORTED | EDITED | UNMODERATED
- if 0:
- print( r.GQL("6fea93cb6fbb",{
- "first":25,
- "includeAllModActivitySummaries":True,
- "includeDevPlatformMetadata":True,
- "includeModActivitySummariesByNames":False,
- "isModqueueListing":True,
- "queueType":"MOD",
- "sort":"SORT_DATE",
- "subredditNames":["BotReddit"]
- }) )
- #Front page
- if 0:
- print( r.GQL("d45d9e249839",{
- "adContext":{
- "layout":"CARD",
- "clientSignalsession.ionData":{
- "adsSeenCount":0,
- "totalPostsSeenCount":128,
- "session.ionStartTime":time.strftime("%Y-%m-%dT%T.0%SZ")
- }
- },
- "feedRankingContext":{
- "servingId":"9e1e75ed-c479-4682-96df-c5218963b844",#This seems to be generated by script, not passed from the servers
- "loggedOutAllowNsfw":True
- },
- "forceGeopopular":True,
- "includeCommunityDUs":False,
- "includeInterestTopics":False,
- "includeFeaturedAnnouncements":True,
- "includeLiveEvents":True,
- "includeIdentity":False,
- "includePostRecommendations":True,
- "includeFreeMarketplaceElement":True,
- "includeSubredditQuestions":True,
- "includeExposureEvents":True,
- "recentPostIds":[],
- "sort":"BEST"
- }) )
- #Pull subreddit posts
- if 0:
- print( r.GQL("abb696a96055",{
- "subredditName":"BotReddit",
- "isFake":False,
- "sort":"HOT",
- "adContext":{
- "layout":"CLASSIC",
- "clientSignalsession.ionData":{
- "adsSeenCount":0,
- "totalPostsSeenCount":25,
- "session.ionStartTime":time.strftime("%Y-%m-%dT%T.0%SZ")
- }
- },
- "includeAchievementFlairs":True,
- "includeCustomEmojis":True,
- "includeIdentity":True,
- "includeInterestTopics":False,
- "includeQuestions":True,
- "includeRules":False,
- "includeRedditorKarma":False,
- "includeSubredditLinks":False,
- "includeSubredditRankings":True,
- "includeSubredditChannels":True,
- "includeTopicLinks":False
- }) )
- #Pull related posts
- if 0:
- print( r.GQL("41973b2a5a8f",{
- "postId":"t3_145xxxx",
- "adContext":{
- "layout":"CARD",
- "sourcePostId":"t3_145xxxx",
- "clientSignalsession.ionData":{
- "adsSeenCount":0,
- "totalPostsSeenCount":28,
- "session.ionStartTime":time.strftime("%Y-%m-%dT%T.0%SZ")
- }
- },
- "range":"WEEK",
- "sort":"TOP",
- "subredditName":"BotReddit",
- "listingBelowCorrelationId":"c9019a43-a3a1-4104-b8fb-71cb0d71af08",
- "nsfwListingBelowCorrelationId":"181cd374-eb40-4f8b-ba5e-b65d0d4cd2f8",
- "includePostFeed":True,
- "includeNSFWListingBelowExperiment":False,
- "includeListingBelowExperiment":False,
- "includePostQASchemaEligibilityFlag":False,
- "includeOtherDiscussions":False
- }) )
- #popular posts
- if 0:
- print( r.GQL("11db30728cfb",{
- "name":"popular",
- "includeIdentity":False,
- "adContext":{
- "layout":"CLASSIC",
- "clientSignalsession.ionData":{
- "adsSeenCount":0,
- "totalPostsSeenCount":0,
- "session.ionStartTime":time.strftime("%Y-%m-%dT%T.0%SZ")
- }
- },"isFake":True,
- "includeAchievementFlairs":False,
- "includeAppliedFlair":False,
- "includeCustomEmojis":False,
- "includeDevPlatformMetadata":True,
- "includeQuestions":False,
- "includeRecents":True,
- "includeRedditorKarma":False,
- "includeRules":False,
- "includeSubredditLinks":False,
- "includeTopicLinks":False,
- "includeTrending":True,
- "includeSubredditRankings":True,
- "includeSubredditChannels":True,
- "isAdHocMulti":False,
- "isAll":False,
- "isLoggedOutGatedOptedin":False,
- "isLoggedOutQuarantineOptedin":False,
- "isPopular":True,
- "recentPostIds":["t3_two5tl","t3_two5fs","t3_two41x","t3_two57b","t3_wswaff"],
- "subredditNames":[],
- "sort":"HOT"
- }) )
- #sub moderation stats/log
- if 0:
- print( r.GQL("bf67bf218716",{
- "subredditName":"BotReddit",
- "currentModName":"SpambotSwatter",
- "startDateInsights":time.strftime("%Y-%m-%dT%T.0%SZ"),
- "endDateInsights":time.strftime("%Y-%m-%dT%T.0%SZ"),
- "includeInsightsData":True,
- #"actions":["APPROVE_LINK"],"first":50
- }) )
- #Pull comments
- #print( r.GQL("1b7d106afc6c","variables":{"postId":"t3_144xxxx","requestPostModerationInfo":True}) )
- #Get post/comment moderated info
- #print( r.GQL("0ac619d6eb7e",{"commentIds":[],"postIds":["t3_147xxxx",...]} }
- #sub moderator list
- #print( r.GQL("fcd88a3eea91",{"subredditName":"BotReddit"}) )
- #sub moderation ctegories {"id":"45bc34defbb5","variables":{}}
- #remove/spam item {"id":"6a4c2bda9036","variables":{"input":{"id":"t3_hvxxxx","isSpam":false}}}
- #approve item {"id":"660e0733e963","variables":{"input":{"id":"t3_r2xxxx"}}}
- #Sticky post {"id":"13de9d1fcbe3","variables":{"input":{"postId":"t3_145xxxx","sticky":true,"toProfile":false}}}
- #subreddit predictorTournaments {"id":"cebfc8734cec","variables":{"subredditName":"BotReddit","isLatestOnly":true}}
- #subreddit platform metadata {"id":"fbfb3b396dfe","variables":{"subredditName":"BotReddit","mimetype":"application/json"}}
- #post reaction info {"id":"72e76fc8e5c5","variables":{"id":"t3_146xxxx"}}
- #post media info {"id":"abbb27126771","variables":{"postId":"t3_145xxxx","includeSubredditRankings":true}}
- #post crowd control {"id":"0100b521f182","variables":{"postId":"t3_145xxxx"}}
- #post stats/shares {"id":"556ffe7b3296","variables":{"postId":"t3_145xxxx","subredditId":"t5_2xxxx"}}
- #subrddit community tags {"id":"bac623887684","variables":{"subredditId":"t5_2xxxx","pageSize":1050}}
- #sub contentrating survey {"id":"15c4ad40a0bc","variables":{"id":"t5_2sxxx"}}
- #sub country settings {"id":"abd8b9be540b","variables":{"subredditId":"t5_2xxxx"}}
- #sub style and stats {"id":"d968e053a7b8","variables":{"id":"t5_2xxxx"}}
- #sub dev platform metadata {"id":"fbfb3b396dfe","variables":{"subredditName":"BotReddit","mimetype":"application/json"}}
- #query UX experiences {"id":"388d61b2a794","variables":{"experienceInputs":["LIVE_CHAT_VIDEO_EDU","LIVE_CHAT_REACTION_EDU"]}}
- #get notifications {"id":"be3e43b15ada","variables":{"first":5}}
- #more notifications{"id":"be3e43b15ada","variables":{"after":base64.b64encode("825d827c-0860-11ee-xxxx-a627b55a708a|t1_jnnxxx"),"first":10}}
- #coin offers {"id":"098518521d5b"}
- #active surveys {"id":"89970a6dad30"}
- #muted subreddits {"id":"c09ff0d041c1"}
- #woke identity {"id":"1508e05ea2ee"}
- #notification settings {"id":"d03522f8a8d4","variables":{"channel":"PUSH"}}
- #update notification setting {"id":"129085be0500","variables":{"input":{"preferences":[{"isEnabled":false,"messageType":"ONE_OFF"}]}}}
- #update inbox seen date {"id":"85d656894a08","variables":{"input":{"lastSentAt":"6/14/2023"}}}
- #mark all chats/messages as read {"id":"bfc6fe51708d","variables":{"input":{"channels":[]}}}
- #saved items {"id":"e355dad0c712","variables":{"includeIdentity":false,"includeModerated":false,"first":25,"after":null}}
- #hidden items {"id":"e15294d413b1","variables":{"includeIdentity":false,"includeModerated":false,"first":25,"after":null}}
- #upvoted posts {"id":"5b90e18285c7","variables":{"includeIdentity":false,"includeModerated":false,"first":25,"after":null}}
- #downvoted posts {"id":"42616342e99c","variables":{"includeIdentity":false,"includeModerated":false,"first":25,"after":null}}
- #received awards {"id":"5e560e39ad16","variables":{"includeIdentity":false,"includeModerated":false,"first":25,"after":null}}
- #given awards {"id":"48cc7f05ceee","variables":{"includeIdentity":false,"includeModerated":false,"first":25,"after":null}}
- #get (recent)post infos {"id":"75c9f18c044f","variables":{"includeIdentity":false,"includeModerated":true,"recentPostIds":["t3_xvxxxx","t3_wsxxxx"]}}
- #Search, reults paginated: your xxxAfter cursor is the ...pageInfo.endCursor value, e.g. data.search.general.comments.pageInfo.endCursor
- if 0:
- print( r.GQL("f4c660a1a7d4",{
- "query":"SpambotSwatter",
- "sort":"NEW",
- "filters":[ {"key":"nsfw","value":"1"}, ],
- "productSurface":"web2x",
- "includePosts":False,
- "includeCommunities":False,
- "includeAuthors":False,
- "includeComments":True,
- "postsAfter":None,
- "communitiesAfter":None,
- "authorsAfter":None,
- "commentsAfter":None,
- "searchInput":{ "queryId":r.token("queryId"),"structureType":"search" },
- "communitySearch":False,
- "customFeedSearch":False,
- #"limit":"50",
- }) )
- #reportForm returns site and subreddit specific reasons via child comment/submission id
- #print( r.GQL("404920cc0308",{"itemId":"t1_jn3s0zq","hostAppName":"R2","formVersion":"2.1","locale":"en-US"}) )
- #Submit Report
- #print( r.GQL("cec8e7309a27",{"input":{"commentId":"t1_jn3sxxx","fromHelpDesk":False,"hostAppName":"R2","siteRule":"SPAM_BOTS"}}}
- #print( r.GQL("cec8e7309a27",{"input":{"commentId":"t1_jmxxxxx","fromHelpDesk":False,"hostAppName":"R2","subredditRule":"Rule 1: Violates Our Policies"}}}
- #print( r.GQL("cec8e7309a27",{"input":{"commentId":"t1_jnxxxxx","fromHelpDesk":False,"hostAppName":"R2","customRule":"This is a scam"}}}
- ################
- #################------ Traditionnal API (still) used by website
- ################
- #Site admin report
- #print( r.OAuth("report",{"raw_json":"1","gilding_detail":"1"},{"reason":"site_reason_selected","site_reason":"This is spam","custom_text":"Scamming in PMs","usernames":"ResponseAvailable395","api_type":"json","from_help_desk":True}) )
- #View modmail
- #print( r.OAuth("mod/conversations",{"sort":"recent","state":"inbox","entity":"BotReddit"}) )
- #Lock item
- #print( r.OAuth("lock","redditWebClient":"desktop2x","app":"desktop2x-client-production","raw_json":1,"gilding_detail":1},{"id":"t3_h5xxxx"}) )
- #make comment
- #print( r.OAuth("comment.json",{"api_type":"json","return_rtjson":True,"thing_id":"t1_xxxxx","text":"","richtext_json":json.dumps( {"document":[{"e":"par","c":[{"e":"text","t":"comment"}]}]} )},{}) )
- #make submission
- #print( r.OAuth("submit",{"resubmit":True},{"sr":"u_spambotswatter","submit_type":"profile","api_type":"json","show_error_list":True,"title":"Post title","spoiler":False,"nsfw":False,"kind":"self","original_content":False,"post_to_twitter":False,"sendreplies":True,"richtext_json":json.dumps( {"document":[{"e":"par","c":[{"e":"text","t":"And the content"}]}]} ),"validate_on_submit":True} ) )
- #edit comment
- #print( r.OAuth("editusertext",{"emotes_as_images":True,"rtj":"only","redditWebClient":"desktop2x","app":"desktop2x-client-production","raw_json":1,"gilding_detail":1},{"api_type":"json","return_rtjson":True,"thing_id":"t1_jo5xxxx","text":None,"richtext_json":json.dumps( {"document":[{"e":"par","c":[{"e":"text","t":"This is my new comment"}]}]} )}) )
- #delete comment, message, ...
- #print( r.OAuth("del",{"redditWebClient":"desktop2x","app":"desktop2x-client-production","raw_json":1,"gilding_detail":1},{"id":"t1_jo5xxxx"}) )
- #upvote dir=1, unvote dir=0, downvote dir=-1, legacy included these, new prob relies on referer: voted from | comment/directlink {"page_type":"comment"} | submission {"page_type":"link","sort":"top"} | userpage {"page_type":"account","sort":"new","sort_filter_time":"all"} | subreddit/frontpage {"page_type":"listing","sort":"new"} | messages {}
- #print( r.OAuth("vote",{"redditWebClient":"desktop2x","app":"desktop2x-client-production","raw_json":1,"gilding_detail":1},{"id":"t3_146xxxx","dir":1,"api_type":"json"}) )
- #block user
- #print( r.OAuth("block_user",{"raw_json":1,"gilding_detail":1},{"name":"spez"}) )
- #unblock user
- #print( r.OAuth("unfriend",{"raw_json":1,"gilding_detail":1},{"name":"SpambotSwatter","container":"t2_3xxxx","type":"enemy"}) )
- #Follow user/subscribe, action=unsub to unfollow
- #print( r.OAuth("subscribe",{"redditWebClient":"desktop2x","app":"desktop2x-client-production","raw_json":1,"gilding_detail":1},{"action":"sub","sr_name":"u_SpambotSwatter","api_type":"json"}) )
- #print( r.OAuth("subscribe",{"redditWebClient":"desktop2x","app":"desktop2x-client-production","raw_json":1,"gilding_detail":1},{"action":"sub","sr_name":"Botreddit","api_type":"json"}) )
- #save item
- #print( r.OAuth("vote",{"redditWebClient":"desktop2x","app":"desktop2x-client-production","raw_json":1,"gilding_detail":1},{"id":"t3_146xxxx"}) )
- #redditor details
- #print( r.OAuth("user/SpambotSwatter/about.json",{"redditWebClient":"desktop2x","app":"desktop2x-client-production","raw_json":1,"gilding_detail":1}) )
- #ignore reports
- #print( r.OAuth("ignore_reports",{"redditWebClient":"desktop2x","app":"desktop2x-client-production","raw_json":1,"gilding_detail":1},{"id":"t3_146xxxx"}) )
- #unignore reports
- #print( r.OAuth("unignore_reports",{"redditWebClient":"desktop2x","app":"desktop2x-client-production","raw_json":1,"gilding_detail":1},{"id":"t3_146xxxx"}) )
- #mark as OC
- #print( r.OAuth("original_content",{"redditWebClient":"desktop2x","app":"desktop2x-client-production","raw_json":1,"gilding_detail":1},{"fullname":"t3_145xxxx","should_set_oc":True}) )
- #enable viewing over18
- #print( r.OAuth("v1/me/prefs",{"raw_json":1,"gilding_detail":1},{"over_18":True}) )
- #go on/offline
- #print( r.OAuth("v1/me/prefs",{"raw_json":1,"gilding_detail":1},{"show_presence":True}) )
- #load more comments, threadid as URI, new comment IDs as token comma-space separated then base64 encoded
- #r.post("https://gateway.reddit.com/desktopapi/v1/morecomments/t3_147xxxx?emotes_as_images=true&rtj=only&redditWebClient=web2x&app=web2x-client-production&profile_img=true&allow_over18=1&include=identity",json={"token":base64.b64encode("jnydxxx, jnz5xxx")})
- #sub moderator list
- #print( r.OAuth("v1/BotReddit/moderators",{"redditWebClient":"desktop2x","app":"desktop2x-client-production","username":"","count":10,"raw_json":1,"gilding_detail":1}) )
- #Assign user flair
- #print( r.OAuth("r/BotReddit/api/selectflair",{"raw_json":1,"gilding_detail":1},{"api_type":"json","flair_template_id":"x-y-z","name":"SpamboSwatter","text":"Swatter of Bots"}) )
- #send message
- if 0:
- r.session.post("https://www.reddit.com/api/compose?embedded=true",{
- "uh":r.tokens["modhash"],
- "to":"/u/SpambotSwatter",
- "undefined":"",
- "subject":"I love",
- "thing_id":"",
- "text":"...you",
- #"g-recaptcha-response":"...",
- "source":"compose",
- "embedded":"web2x",
- "id":"/compose-message",
- "renderstyle":"html"
- })
- #mark message read
- #r.session.post("https://www.reddit.com/api/read_message?embedded=true",{"id":"t4_1vvxxxx","uh":r.tokens["modhash"],"renderstyle":"html"})
- #mark message unread
- #r.session.post("https://www.reddit.com/api/unread_message?embedded=true",{"id":"t4_1vvxxxx","executed":"unread","embedded":"web2x","uh":r.tokens["modhash"],"renderstyle":"html"})
- ################
- #################---legacy website funcs, no new.reddit analogue?
- ################
- #redditor comments
- #print( r.get("https://gateway.reddit.com/desktopapi/v1/user/SpambotSwatter/comments?rtj=only&emotes_as_images=true&allow_quarantined=true&redditWebClient=web2x&app=web2x-client-production&profile_img=true&allow_over18=1&include=identity&sort=new") )
- #Add Friend
- #print( r.post("https://www.reddit.com/friend?note=",body=urllib.parse.urlencode( {"nam":"SpambotSwatter","container":"t2_xxxxx","type":"friend","r":"u_SpambotSwatter","uh":r.token("modhash"),"renderstyle":"html"} )) )
- #Remove friend
- #print( r.post("https://www.reddit.com/unfriend",body=urllib.parse.urlencode( {"nam":"SpambotSwatter","container":"t2_xxxxx","type":"friend","r":"u_SpambotSwatter","uh":r.token("modhash"),"renderstyle":"html"} )) )
- #Assign user flair
- #print( r.post("https://www.reddit.com/api/flair",body=urllib.parse.urlencode( {"name":"SpambotSwatter","text":"Swatter of Bots","css_class":"","id":"%flair-fukubaka","r":"BotReddit","uh":r.token("modhash"),"renderstyle":"html"} )) )
- #Create app
- #print( r.post("https://www.reddit.com/api/updateapp",body=urllib.parse.urlencode( {"uh":r.token("modhash"),"name":"ScriptName","app_type":"script","description":"Script Desc.","about_url":"http://about.com/","redirect_uri":"http://redirect.com","id":"%create-app","renderstyle":"html"} )) )
Add Comment
Please, Sign In to add comment