Skip to content

Instantly share code, notes, and snippets.

Created Sep 27, 2018
What would you like to do?
import os
import requests
import re
new_header = 'Mozilla/5.0 (X11; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0'
headers = {'User-Agent': new_header}
r_url = re.compile('<a href="(http\S+)" target=_blank>archive here</a>')
re_exists_url = re.compile("archive here: <a href=(http\S+?)>http\S+?</a></h3>")
class ST_handler(object):
def __init__(self):
self.enabled = True = 'The'
self.api_required = False
def push(self, uri_org, p_args=[]):
msg = ''
post_data = {"url": uri_org}
r ="",
data=post_data, headers=headers)
page = str(r.content)
results = r_url.findall(page)
if results:
msg = results[0]
elif "ERROR" in page:
new_results = re_exists_url.findall(page)
msg = new_results[0]
except Exception as e:
msg = "ERROR: ({0})".format(e)
return msg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment