(Using Medium API Python Package)
If you want to fetch a list of tags or interests followed by a Medium user, you can accomplish this easily using the Medium API. Below, we provide a step-by-step guide on how to do this with Python.
Ensure you have the medium-api library installed. You can install it via pip:
pip install medium-api
Start by importing the necessary libraries. You will need the os module to access environment variables and the Medium class from the medium_api package.
Fetch the API key from your environment variables. This key is essential for authenticating your requests to the Medium API.
Instantiate the Medium class with your API key. This object will be used to interact with the Medium API.
Use the Medium object to create a User object. Pass the username of the Medium user whose interests you want to retrieve.
Loop through the interests of the user and print each one. This will display the tags or interests that the user follows.
For the output of this script, refer to the following gist:
By following these steps, you can easily get a list of tags or interests followed by any Medium user. This can be particularly useful for analyzing user preferences or content trends on Medium.