Hey @dipansha.chhabra19,
I would recommend you not to use beautiful soup here.
Since the API here is returning json format, therefore we just need to send a get request using this command requests.get(url)
to the url, and the response it will return in json and therefore we can extract the joke easily.
Follow these simple steps:
- Read the ID.csv and consider the values of IDs.
- iterate over all the ids, and make a get request to the updated url (change id everytime)
- from the response you get, extract the joke with json format, and append this joke to one list that was earlier initialized as empty.
- make a dataframe with 2 columns ID and Joke, and convert it to csv format.
Thanks