def _unshorten_shst(self, uri):
        try:
            r = requests.get(uri, headers=self._headers, timeout=self._timeout)
            html = r.text

            session_id = re.findall(r'sessionId\:(.*?)\"\,', html)
            if len(session_id) > 0:
                session_id = re.sub(r'\s\"', '', session_id[0])

                http_header = {
                    "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.46 Safari/535.11",
                    "Accept-Encoding": "gzip,deflate,sdch",
                    "Accept-Language": "en-US,en;,q=0.8",
                    "Connection": "keep-alive",
                    "Content-Type": "application/x-www-form-urlencoded",
                    "Host": "sh.st",
                    "Referer": uri,
                    "Origin": "http://sh.st",
                    "X-Requested-With": "XMLHttpRequest"
                }

                time.sleep(5)

                payload = {'adSessionId': session_id, 'callback': 'c'}
                r = requests.get('http://sh.st/shortest-url/end-adsession', params=payload, headers=http_header, timeout=self._timeout)
                response = r.content[6:-2].decode('utf-8')
                
                if r.status_code == 200:
                    resp_uri = json.loads(response)['destinationUrl']
                    if resp_uri is not None:
                        uri = resp_uri
                    else:
                        return uri, 'Error extracting url'
                else:
                    return uri, 'Error extracting url'

            return uri, r.status_code

        except Exception as e:
            return uri, str(e)
dataset/ETHPy150Open jkehler/unshortenit/unshortenit/base.py/UnshortenIt._unshorten_shst/original