INNER CODE UNIT · Python

get_graphql

fa0311/TwitterInternalAPIDocument · lib/graphql.py:10

def get_graphql(parsed_list: JsData) -> list:
    reg_graphql = r"e\.graphQL\({func}\(\),$".format(func=r"([a-zA-Z_$]{1,2})")
    graphql_list = search_js_reg(parsed_list, reg_graphql)
    graphql_output = []

    for graphql in tqdm(graphql_list):
        reg_func = r"{func}=t.n\({arg}\)".format(
            func=re.escape(graphql.data[0]),
            arg=r"([a-zA-Z_$]{1,2})",
        )

        graphql_parent = graphql.parent
        match_func = search_js_reg(graphql_parent, reg_func)
        while match_func == []:
            graphql_parent = graphql_parent.parent
            if graphql_parent == None:
                break
            match_func = search_js_reg(graphql_parent, reg_func)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…