The first post was correct no need to mix in json library.
import requests response = requests.get('https://a.4cdn.org/biz/catalog.json') catalog = response.json() # CorrectSome tips,also a couple of libraries(jmespath | nested-lookup) that can help search a nested dictionary that
json
can return.import requests from nested_lookup import nested_lookup import jmespath response = requests.get('https://a.4cdn.org/biz/catalog.json') catalog = response.json() # Ordinay way find_sub = catalog[0]['threads'][0]['sub'] print(find_sub) # Find all <md5> using nested_lookup find_md5 = nested_lookup('md5', catalog)[:5] print(find_md5) # Find thread <no> using jmespath thread_no = jmespath.search('threads[*].no', catalog[0]) print(thread_no)
Output:NO BEGGING
['pJvXhdg2z1jzhaXDpXJCSA==', 'FnhPHN6dqDf2BRAe/KlekQ==', 'otmlJIe2Z8Ie1tOznSJeTw==', 'bYhv5BMl3FDUl6Ij35KjFA==', 'aH0WKPS4g13LSXvNvXP8ZQ==']
[4884770, 21374000, 33546252, 33545084, 33529907, 33548153, 33544096, 33534099, 33546968, 33546648, 33547703, 33545399, 33533316, 33544886, 33547053, 33548145, 33547368, 33547858, 33545941, 33546379]