from pathlib import Path
p=Path('/opt/struktur/social-media-radar/watch_entities.yaml')
s=p.read_text()
old=''' canonical_name: Murprotec Islas Baleares\n entity_id: murprotec_baleares\n geography: mallorca\n'''
new=''' canonical_name: Murprotec Islas Baleares\n entity_id: murprotec_baleares\n facebook_handle: murprotec.es\n facebook_url: https://www.facebook.com/murprotec.es/\n instagram_handle: murprotec\n instagram_url: https://www.instagram.com/murprotec/\n linkedin_url: https://es.linkedin.com/company/murprotec\n geography: mallorca\n'''
if old not in s: raise SystemExit('murprotec entity anchor missing')
p.write_text(s.replace(old,new,1))