MCPcopy
hub / github.com/InstaPy/InstaPy / extract_text_from_element

Function extract_text_from_element

instapy/util.py:2142–2155  ·  view source on GitHub ↗

As an element is valid and contains text, extract it and return Added filter to words that has spaces between them, they for sure are not valid username Error looks like: "User: 'NOVEMBER 5' |> followers: unknown |> following: unknown |> relationship ratio: unknown"

(elem)

Source from the content-addressed store, hash-verified

2140
2141
2142def extract_text_from_element(elem):
2143 """
2144 As an element is valid and contains text, extract it and return
2145 Added filter to words that has spaces between them, they for sure are not valid username
2146 Error looks like: "User: 'NOVEMBER 5' |> followers: unknown |> following: unknown |> relationship ratio: unknown"
2147 ^^^^^^^^^^^^^^^^^
2148 """
2149
2150 # if element is valid and contains text withou spaces
2151 if elem and hasattr(elem, "text") and elem.text and not re.search("\s", elem.text):
2152 return elem.text
2153
2154 # if the element is not valid, return None
2155 return None
2156
2157
2158def truncate_float(number, precision, round=False):

Callers 2

get_users_from_dialogFunction · 0.85
like_commentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected