1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ストックされた投稿を調べる

Last updated at Posted at 2013-01-07

ストックされた投稿を調べる簡単な方法がなかったので、QiitaAPIを使って、Pythonで書いてみました。
ユーザ名を適宜直してください。
タイトルの一覧とストック数が出力されます。

Python
import urllib2
import json

def getweb(url):
	fp = urllib2.urlopen(url)
	s = fp.read()
	fp.close()
	return json.loads(s)	

user = 'ユーザ名'
for i in xrange(1, 100):
	url = 'https://qiita.com/api/v1/users/%s/items?page=%s' % (user, i)
	lst = getweb(url)
	if (len(lst) == 0): break
	for d in lst:
		n = int(d['stock_count'])
		if (n > 0):
			print d['title'], n
1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?