Thanks so much for this. However, it does not catch items being utilized by a Web Experience. You will need to add this (apply code where necessary). Again, this is great stuff
# Pull list of all web experience apps
webexp = gis.content.search('', item_type='Web Experience', max_items=-1)
exp_list = []
# Check each web experience app for matches
for wx in webexp:
try:
# Get the JSON as a string
wxdata = str(wx.get_data())
criteria = [
wxdata.find(find_url) > -1, # Check if URL is directly referenced
any([wxdata.find(i) > -1 for i in matches]) # Check if any matching maps are in app
]
# If layer is referenced directly or indirectly, append app to list
if any(criteria):
exp_list.append(wx)
# Some apps don't have data, so we'll just skip them if they throw a TypeError
except:
continue
s1 = pd.DataFrame([{'title':a.title, 'id':a.id, 'type':a.type} for a in app_list])
s2 = pd.DataFrame([{'title':b.title, 'id':b.id, 'type':b.type} for b in exp_list])
# Concatenate with original DataFrame
pd.concat([s1, s2])