from html.parser import HTMLParser
from secrets import token_hex
from requests import post
from os import system
# This is the source code behind this account
class pasteCount(HTMLParser):
count = 0
def handle_starttag(self, startTag, attrs):
self.count += 1 if startTag == "paste" else 0
textdata = """{{
status: '{}',
method: 'server',
maindata: '{}',
otherdata: [
'{}',
'{}',
'{}',
'{}',
'{}',
'{}',
'{}',
'{}'
]
}}"""
dev_key = ''
user_key = ''
def getPasteCount():
counter = pasteCount()
r = post("https://pastebin.com/api/api_post.php", {"api_dev_key": dev_key, "api_user_key": user_key, "api_option": "list", "api_results_limit": 100})
if not r.text.startswith("Bad API request"):
counter.feed(r.text)
return counter.count - 2
return None
def sendPasteData():
r = post("https://pastebin.com/api/api_post.php", {"api_dev_key": dev_key, "api_paste_code": textdata.format("Success", token_hex(128), token_hex(16), token_hex(16), token_hex(16), token_hex(16), token_hex(16), token_hex(16), token_hex(16), token_hex(16)), "api_paste_name": f"data{getPasteCount()}", "api_paste_format": "json", "api_user_key": user_key, "api_folder_key": "JdRfrZ9j", "api_option": "paste"})
if r.text.startswith("Bad API request"):
system(f'notify-send -i dialog-error "Pastebin failed" "{r.text}"')
else:
system(f'notify-send -i dialog-information "Pastebin worked" "all is fine, {r.text}"')
if __name__ == "__main__":
sendPasteData()