Last active
January 23, 2025 15:49
[Get User's Articles] Code to get all the articles written by a Medium User. #python #medium_api #medium_api_py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import libraries | |
import os | |
from medium_api import Medium | |
# Get RAPIDAPI_KEY from the environment | |
api_key = os.getenv('RAPIDAPI_KEY') | |
# Create a `Medium` Object | |
medium = Medium(api_key) | |
# Create an "User" Object using 'username' | |
user = medium.user(username="nishu-jain") | |
# Fetch user-written articles | |
user.fetch_articles() | |
# Iterate over user articles and print their title | |
for article in user.articles: | |
print(article.title) | |
# Number of Pinned Articles | |
print("\nNumber of Pinned Articles: ", user.total_pinned_articles) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import libraries | |
import os | |
from medium_api import Medium |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get RAPIDAPI_KEY from the environment | |
api_key = os.getenv('RAPIDAPI_KEY') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a `Medium` Object | |
medium = Medium(api_key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create an "User" Object using 'username' | |
user = medium.user(username="nishu-jain") | |
# Fetch user-written articles | |
user.fetch_articles() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Iterate over user articles and print their title | |
for article in user.articles: | |
print(article.title) | |
# Number of Pinned Articles | |
print("\nNumber of Pinned Articles: ", user.total_pinned_articles) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
About Me :) — Nishu Jain | |
Health-Wealth-Relationships | |
It Began as an Ordinary day, but it Changed my Life | |
Acting “OK” Even When I Am Not | |
. | |
. | |
. | |
Luck, Quantum entanglement and Psychology | |
You’ll Never Be A Great Writer [Not Your Average Article] | |
4 Tips to Strengthen Your Bonds — Now | |
My Dear Doppelganger … | |
Number of Pinned Articles: 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment