Correct extraction of information from vCard4 Over XMPP (XEP-0292).
Thank you to Marvin W.
This commit is contained in:
parent
373b7b1f05
commit
10215d7fca
2 changed files with 18 additions and 10 deletions
15
fasi.py
15
fasi.py
|
@ -1563,16 +1563,13 @@ class Syndication:
|
|||
'peertube' : [],
|
||||
}
|
||||
for res in extra_resources:
|
||||
try:
|
||||
count = len(xml_data.findall(namespace + 'group[@name="' + res + '"]/' + namespace + 'x-ablabel'))
|
||||
except:
|
||||
breakpoint()
|
||||
for p in range(count):
|
||||
position = str(p + 1)
|
||||
print(res, position)
|
||||
for i in xml_data.find(namespace + 'group[@name="' + res + '"]/' + namespace + 'x-ablabel[' + position + ']'):
|
||||
#for element in xml_data.findall(namespace + 'group[contains(@name, "{}")]'.format(res)):
|
||||
#for element in xml_data.findall(namespace + 'group[strats-with(@name, "{}")]'.format(res)):
|
||||
matching_elements = [group for group in xml_data.findall(namespace + "group") if res in group.get('name', '')]
|
||||
for element in matching_elements:
|
||||
for i in element.find(namespace + 'x-ablabel'):
|
||||
txt = i.text
|
||||
for i in xml_data.find(namespace + 'group[@name="' + res + '"]/' + namespace + 'url[' + position + ']'):
|
||||
for i in element.find(namespace + 'url'):
|
||||
uri = i.text
|
||||
extra_resources[res].append({'label' : txt, 'uri' : uri})
|
||||
vcard[res] = extra_resources[res]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue