Apr-20-2021, 10:23 PM
(Apr-20-2021, 09:20 PM)Axel_Erfurt Wrote: Do I understand correctly that you want to find something?
import requests import json response = requests.get('https://a.4cdn.org/biz/catalog.json') catalog = json.loads(response.text) print(catalog[0]['threads'][0].keys()) length = len(catalog) the_name = "Anonymous" for x in range(length - 1): my_range = 10 for a in range(my_range): name = catalog[x]['threads'][a]['name'] if name: if name == the_name: print("found", the_name, "at", a, x)
Hi Axel, correct, I'm trying to search parts of each thread for something. Each thread is a dict containing a 'sub' and a 'com' key, I'm trying to search the value of these for some keywords (I'm using the keyword 'doge' to test). If a keyword is found I'd like to return the value of the 'no' key for that thread.
Thanks!