Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env python3
# very crude but works ;-)
import bs4
import base64
bs4.BeautifulSoup(open('sms.xml'), 'lxml-xml')
for part in parts:
if part.parent.parent.findAll('addr', attrs={'address':'+48XXXXXXXXXX'}):
if part.attrs['ct'] not in ('text/plain', 'application/smil'):
open('extracted/{}'.format(part.attrs['cl']), 'wb').write(base64.decodestring(part.attrs['data'].encode('ascii')))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment