MCPcopy Index your code
hub / github.com/geekcomputers/Python / dataprocess

Function dataprocess

insta_monitering/insta_datafetcher.py:55–75  ·  view source on GitHub ↗
(htmldata)

Source from the content-addressed store, hash-verified

53
54
55async def dataprocess(htmldata):
56 bs4obj = bs4.BeautifulSoup(htmldata, "html.parser")
57 scriptsdata = bs4obj.findAll("script", {"type": "text/javascript"})
58 datatext = ""
59 for i in scriptsdata:
60 datatext = i.text
61 if "window._sharedData =" in datatext:
62 break
63 datajson = re.findall("{(.*)}", datatext)
64 datajson = "{" + datajson[0] + "}"
65 datadict = ujson.loads(datajson)
66 maindict = {}
67 datadict = datadict["entry_data"]["PostPage"][0]["graphql"]["shortcode_media"]
68 tofind = ["owner", "location"]
69 for i in tofind:
70 try:
71 maindict[i] = datadict[i]
72 except Exception as e:
73 print(e)
74 pass
75 return maindict
76
77
78async def datapullpost(future, url):

Callers 1

datapullpostFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected