:authority: c1.monidai.com
:method: GET
:path: /20210826/ArvjnK0H/index.m3u8
:scheme: https
accept: */*
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9,zh-TW;q=0.8,zh;q=0.7
origin: https://gimy.app
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="98", "Google Chrome";v="98"
sec-ch-ua-mobile: ?1
sec-ch-ua-platform: "Android"
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: cross-site
user-agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Mobile Safari/537.36
import re
def get_Request_headers(Request_headers):
headers = {}
key = list(map(lambda x: x.split(" ")[-2][:-1], re.findall("\s+.*?\:\s+", " " + Request_headers)))
for i in range(len(key)):
try:
headers[key[i]] = re.sub('\"',"'",re.search("%s\:\s+(.*?)\s+%s"%(key[i],key[i+1]), Request_headers).group(1))
except:
headers[key[i]] = re.sub('\"',"'",re.search("%s\:\s+(.*)"%(key[i]), Request_headers).group(1))
return headers
def print_headers(headers):
for i, prop in enumerate(headers):
if i == 0:
print("""\nheaders = {\n"%s": "%s","""%(prop, headers[prop]))
continue
if i == len(headers)-1:
print(""""%s": "%s"}"""%(prop, headers[prop]))
continue
print(""""%s": "%s","""%(prop, headers[prop]))
Request_headers = input("Please enter request headers \n>>>")
print_headers(get_Request_headers(Request_headers))