Back to articles
Dev.to Has a Free API — Analyze Your Article Performance in 20 Lines of Python

Dev.to Has a Free API — Analyze Your Article Performance in 20 Lines of Python

via Dev.to PythonAlex Spinov

You're Writing Blind If you're publishing on Dev.to, you probably check your dashboard occasionally. But do you actually know: Which tags get you the most views? What day of the week gets the most engagement? Which article format performs best? Dev.to has a free API that gives you all this data. Let me show you. Setup Get your API key: Settings → Extensions → DEV Community API Keys → Generate. 1. Your Top Articles import requests API_KEY = " your-api-key " headers = { " api-key " : API_KEY } # Get your articles (up to 1000) articles = [] for page in range ( 1 , 11 ): batch = requests . get ( f " https://dev.to/api/articles/me?per_page=100&page= { page } " , headers = headers ). json () if not batch : break articles . extend ( batch ) print ( f " Total articles: { len ( articles ) } " ) # Sort by views top = sorted ( articles , key = lambda a : a . get ( " page_views_count " , 0 ), reverse = True ) print ( " \n 📊 Top 10 Articles: " ) for i , a in enumerate ( top [: 10 ], 1 ): views = a

Continue reading on Dev.to Python

Opens in a new tab

Read Full Article
2 views

Related Articles