Apr-20-2021, 04:17 PM
Hello,
first off I'd like to say I'm very new, and this is my first attempt at using Python to create a useful program for myself, so go easy on me pls.
What I'm trying to create is a program that will search through the API of 4chans /biz/ catalog for some keywords and email me with the thread link when my keywords are being spoken about. To start off I've requested the API and attached it to a variable using:
![[Image: Dict.jpg]](https://i.ibb.co/JpfKqQk/Dict.jpg)
So, I have an 11 item list, one for each page. One level deeper I have a dict -> page : with the value of the page #, and then a list of 20 dicts, with all of the keys and values for each thread.
What I'm trying to do is iterate through each thread, on each page and search the values of 'sub' and 'com' for my keywords, if they show up I want to return the value of the 'no' key for that thread. Then I can append that number to then end of a url and email it to myself every time a new post pops up.
I understand I'm biting off a bit more than I can chew here with my skillset, and I'm not asking for someone to write the code for me, rather, if someone knows any resources that could help me better understand how to search through complicated lists of nested lists and dicts, as alot of the tutorials I've found online either, aren't working with lists this complicated, or trying to do something completely different.
Anyways, thanks for reading,
Pop.
first off I'd like to say I'm very new, and this is my first attempt at using Python to create a useful program for myself, so go easy on me pls.
What I'm trying to create is a program that will search through the API of 4chans /biz/ catalog for some keywords and email me with the thread link when my keywords are being spoken about. To start off I've requested the API and attached it to a variable using:
import requests response = requests.get('https://a.4cdn.org/biz/catalog.json') catalog = response.json()When I print this it returns a lovely big list with other nested dictionaries and lists, as this image illustrates:
![[Image: Dict.jpg]](https://i.ibb.co/JpfKqQk/Dict.jpg)
So, I have an 11 item list, one for each page. One level deeper I have a dict -> page : with the value of the page #, and then a list of 20 dicts, with all of the keys and values for each thread.
What I'm trying to do is iterate through each thread, on each page and search the values of 'sub' and 'com' for my keywords, if they show up I want to return the value of the 'no' key for that thread. Then I can append that number to then end of a url and email it to myself every time a new post pops up.
I understand I'm biting off a bit more than I can chew here with my skillset, and I'm not asking for someone to write the code for me, rather, if someone knows any resources that could help me better understand how to search through complicated lists of nested lists and dicts, as alot of the tutorials I've found online either, aren't working with lists this complicated, or trying to do something completely different.
Anyways, thanks for reading,
Pop.