Exercise Title: News Aggregator with Data Submission
Objective:
Create a small application (it can be an API or a single file) that fetches the latest news articles on a user-specified topic and then submits selected article data to another API endpoint.
NewsAPI: Use the NewsAPI to fetch news articles. An API key will be provided by the interviewer.
User/Program Input: Allow the user or another program to input a topic or keyword (e.g., "technology", "health", "sports").
Data Retrieval: Fetch the latest news articles related to the input topic using the /v2/everything endpoint.
Display a list of fetched news articles with their titles, sources, and publication dates. Prepare the first 5 results from the list for submission.
JSONPlaceholder API: Use the JSONPlaceholder API to submit data.
For each selected article, submit a new post to an endpoint that will be given to you by the hiring manager using a POST request to /posts.Data Mapping:
Title: Map the article's title to the title field.
Body: Map the article's description or content to the body field.
UserId: Generate a random id with low chances of collision
Handle errors such as network issues, invalid API responses, or submission failures. Provide clear feedback to the user in case of errors.