파이썬 2로 자기가 쓴 Zenn의 글 일람.
젠의 글 일람표를 얻으려고 파이썬(python 2)으로 코드를 써봤어요.Zenn은 비공식적이지만 json에서 데이터를 얻을 수 있는 API가 있는데 실제 데이터는 이런 느낌(2021/4/4시)이다.
3
{
"article_type": "tech",
"body_letters_count": 849,
"body_updated_at": "2021-04-02T19:32:32.584+09:00",
"comments_count": 0,
"created_at": "2021-04-02T19:28:56.319+09:00",
"emoji": "\ud83d\udd16",
"id": 29562,
"is_suspending_private": false,
"liked_count": 3,
"published": true,
"published_at": "2021-04-02T19:28:56.219+09:00",
"reading_time": 0,
"slug": "swiftui-zucks",
"source_repo_updated_at": "2021-04-02T19:32:32.584+09:00",
"title": "SwiftUI\u3067Zucks\u3092\u5229\u7528\u3057\u3066\u30d0\u30ca\u30fc\u5e83\u544a\u3092\u8868\u793a\u3059\u308b",
"topics": [
{
"display_name": "zucks",
"id": 6435,
"image_url": null,
"name": "zucks",
"taggings_count": 1
},
{
"display_name": "SwiftUI",
"id": 393,
"image_url": "https://storage.googleapis.com/zenn-user-upload/topics/9b3c8449b6.jpeg",
"name": "swiftui",
"taggings_count": 97
},
{
"display_name": "Swift",
"id": 115,
"image_url": "https://storage.googleapis.com/zenn-topics/swift.png",
"name": "swift",
"taggings_count": 348
},
{
"display_name": "iOS",
"id": 62,
"image_url": "https://storage.googleapis.com/zenn-topics/ios.png",
"name": "ios",
"taggings_count": 428
}
],
"updated_at": "2021-04-04T07:15:15.600+09:00",
"user": {
"avatar_small_url": "https://storage.googleapis.com/zenn-user-upload/avatar/icon_d8a9473a36.jpeg",
"id": 60,
"name": "yorifuji",
"username": "yorifuji"
}
}
글의 일람을 얻는 코드는 여기에 있습니다.main.py
import json
import urllib
username='yorifuji'
params = urllib.urlencode({'username':username})
articles_json = json.loads(urllib.urlopen('https://api.zenn.dev/articles?%s' % params).read())["articles"]
class Article:
def __init__(self, json):
self.id = json["id"]
self.title = json["title"].encode('utf-8')
self.created_at = json["created_at"].encode('utf-8')
self.published = json["published"]
self.url = 'https://zenn.dev/%s/articles/%s' % (username, json["slug"].encode('utf-8'))
articles = sorted(filter(lambda article: article.published, [Article(json) for json in articles_json]), key=lambda article: article.created_at)
print "id,title,url,created_at"
for article in articles:
print "%d,%s,%s,%s" % (article.id, article.title, article.url, article.created_at)
출력2344,iOS14に追加されたAirPodsProのモーションを取得するAPIを調べる,https://zenn.dev/yorifuji/articles/19a4aa065f41309d3b95,2020-09-22T19:55:17.843+09:00
4607,AirPodsProのセンサー情報を取得する,https://zenn.dev/yorifuji/articles/a508862e9fea55b2ca7e,2020-09-28T23:34:59.287+09:00
5559,AirPods Proのモーションデータをcsvファイルに記録する,https://zenn.dev/yorifuji/articles/1632a1d8ff6f3b98c134,2020-10-03T10:15:05.526+09:00
5601,AirPods Proのモーションセンサーを使って体の動きを機械学習で判定する,https://zenn.dev/yorifuji/articles/bc315373b207667206e4,2020-10-03T15:00:02.042+09:00
6179,指差し確認をApple Watchと機械学習を使って検出する,https://zenn.dev/yorifuji/articles/af1b54285c1c4f7a3249,2020-10-06T22:23:10.856+09:00
6818,WCSessionを使ってファイル転送するときの注意点,https://zenn.dev/yorifuji/articles/7a4d6766f50cd02319b7,2020-10-10T19:24:21.552+09:00
9684,iOSで利用できる機械学習系のText Recognitionフレームワークの調査,https://zenn.dev/yorifuji/articles/ios-japanese-text-recognition-framework,2020-10-30T17:31:41.299+09:00
9855,2020年10月の振り返り,https://zenn.dev/yorifuji/articles/self-release-note-202010,2020-11-01T13:24:40.356+09:00
10238,Microsoftの機械学習のトレーニングツール「Lobe」を使って作成したiOSの画像分類モデルについて,https://zenn.dev/yorifuji/articles/lobe-ios-coreml-model,2020-11-04T01:19:05.710+09:00
11996,Firebase Machine Learningの文字認識機能を使ってみる,https://zenn.dev/yorifuji/articles/ios-firebase-ml-text-recognition-app,2020-11-22T20:09:31.348+09:00
12052,「UIKit丸出し」で十分な人向けのSwiftUI,https://zenn.dev/yorifuji/articles/ios-swiftui-basis,2020-11-23T13:08:58.669+09:00
12973,2020年11月の振り返り,https://zenn.dev/yorifuji/articles/self-release-note-202011,2020-12-01T19:12:30.671+09:00
17582,2020年12月の振り返り,https://zenn.dev/yorifuji/articles/self-release-note-202012,2021-01-05T01:37:41.294+09:00
18508,SwiftUIでAVFoundationを使ってフレームバッファを取得する,https://zenn.dev/yorifuji/articles/swiftui-avfoundation,2021-01-12T01:38:44.164+09:00
20943,SwiftUIからFirebaseUIを使う,https://zenn.dev/yorifuji/articles/swiftui-firebaseui,2021-01-30T20:32:41.769+09:00
21344,SwiftUIのNavigationViewで画面全体に背景色を適用する,https://zenn.dev/yorifuji/articles/swiftui-navigationview-bgcolor,2021-02-02T00:20:26.156+09:00
21532,2021年1月の振り返り,https://zenn.dev/yorifuji/articles/self-release-note-202101,2021-02-03T11:44:04.853+09:00
25731,Firebase Storageにバケットを追加する,https://zenn.dev/yorifuji/articles/firebase-storage-multi-buckets,2021-03-04T22:27:34.199+09:00
26079,SwiftUIでUIViewを表示する,https://zenn.dev/yorifuji/articles/swiftui-uiviewrepresentable,2021-03-07T15:54:01.658+09:00
26091,SwiftUIでSkyWayの映像を表示する(SwiftUIでSKWVideoを使う方法),https://zenn.dev/yorifuji/articles/swiftui-skyway-skwvideo,2021-03-07T17:54:10.542+09:00
27193,SwiftUIでAdMobを使ってバナー広告を表示する,https://zenn.dev/yorifuji/articles/swiftui-admob,2021-03-16T01:20:53.914+09:00
27423,SwiftUIでアルファベットと数字だけ入力できるTextField,https://zenn.dev/yorifuji/articles/swiftui-textfield-filter,2021-03-17T22:59:10.609+09:00
27577,SwiftUIのPreviewのちょっと便利な使い方,https://zenn.dev/yorifuji/articles/swiftui-preview-tips,2021-03-18T23:55:06.908+09:00
27699,SwiftUIでUIImagePickerControllerを使う,https://zenn.dev/yorifuji/articles/swiftui-imagepicker,2021-03-19T18:58:41.509+09:00
27843,iOSでAdMobが表示されなくなったので確認したこと(進行形),https://zenn.dev/yorifuji/articles/swiftui-admob-error,2021-03-20T19:37:52.133+09:00
28007,MediaStreamから音声ストリームを取り出して左右に振り分けたストリームを作成する,https://zenn.dev/yorifuji/articles/mediastream-channel,2021-03-21T19:59:47.436+09:00
28184,SwiftUIでダウンロードした画像を表示する,https://zenn.dev/yorifuji/articles/swiftui-download-image-async,2021-03-22T23:57:29.606+09:00
28309,iOS14のAppTrackingTransparencyに対応するためにやったこと,https://zenn.dev/yorifuji/articles/ios-app-tracking-transparency,2021-03-24T01:37:42.606+09:00
28502,Keystoreとバイナリのフィンガープリントを確認する(Android),https://zenn.dev/yorifuji/articles/android-keystore-fingerprint,2021-03-25T20:03:36.227+09:00
28713,2021年2月の振り返り,https://zenn.dev/yorifuji/articles/self-release-note-202102,2021-03-27T16:46:41.795+09:00
28778,SwiftUIのNavigationViewでiPhoneとiPadの動作を合わせる,https://zenn.dev/yorifuji/articles/swiftui-navigationviewstyle-stack,2021-03-28T00:40:55.192+09:00
29465,SwiftUIのiPadアプリでAdMobを使うときに必要な設定,https://zenn.dev/yorifuji/articles/swiftui-admob-ipad,2021-04-01T20:45:13.198+09:00
29562,SwiftUIでZucksを利用してバナー広告を表示する,https://zenn.dev/yorifuji/articles/swiftui-zucks,2021-04-02T19:28:56.319+09:00
29624,Zenn CLIで執筆するためのMakefileの手始め,https://zenn.dev/yorifuji/articles/zenn-makefile,2021-04-03T12:40:16.717+09:00
참고 자료
Zenn의 API가 이 글을 참고해 주셔서 감사합니다.
Reference
이 문제에 관하여(파이썬 2로 자기가 쓴 Zenn의 글 일람.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://zenn.dev/yorifuji/articles/python2-get-zenn-articles텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)