The feedly Cloud APIではてなブックマークお気に入りのタイトルを表示
以下のリンクを開き、Googleのhiroyuki12でログインして、developer access tokenを取得
Gmailに届いたメールのリンクを開いてdeveloper access tokenを取得。
Developer Access Tokens | feedly Cloud API
リージョン us-east-1 で作成した
Lambda - CallFeedlyAPI -設定 - 環境変数で設定
profileを取得して表示
$ curl -H "Authorization: OAuth yourAccessTokenValueGoesHere" https://cloud.feedly.com/v3/profile
Overview | feedly Cloud API v3
Terminalでjsonを整形して表示できるようにjqをインストールする。
$ b jq
フィードの未読数を取得
$ curl -H "Authorization: OAuth yourAccessTokenValueGoesHere" https://cloud.feedly.com/v3/markers/counts | jq
BORDS一覧を取得
$ curl -H "Authorization: OAuth yourAccessTokenValueGoesHere" https://cloud.feedly.com/v3/boards | jq
collections(FEEDSの下にあるカテゴリ)一覧を取得(feedsのfeedid他も取得)
$ curl -H "Authorization: OAuth yourAccessTokenValueGoesHere" https://cloud.feedly.com/v3/collections | jq
categories(FEEDSの下にあるカテゴリ)一覧を取得 (idとlabelとcreatedのみ)
$ curl -H "Authorization: OAuth yourAccessTokenValueGoesHere" https://cloud.feedly.com/v3/categories | jq
How to get all unread items using Feedly API - Stack Overflow
⭐️categoryがItの未読の記事のタイトル他を取得
$ curl -H "Authorization: OAuth yourAccessTokenValueGoesHere" 'https://cloud.feedly.com/v3/streams/contents?streamId=user/yourUserIdGoesHere/category/It&unreadOnly=true' | jq
How to get all unread items using Feedly API - Stack Overflow
⭐️categoryがglobal.uncategorizedの記事のタイトル他を取得
$ curl -H "Authorization: OAuth yourAccessTokenValueGoesHere" 'https://cloud.feedly.com/v3/streams/contents?streamId=user/yourUserIdGoesHere/category/global.uncategorized' | jq
yourAccessTokenValueGoesHereと yourUserIdGoesHereは実際の値に置き換え
let url: URL = URL(string: str7)!
var request = URLRequest(url: url)
request.setValue(Constants.feedlyDeveloperToken, forHTTPHeaderField: "Authorization")
let task: URLSessionTask = URLSession.shared.dataTask(with: request, completionHandler: {data, response, error in
リンクのURLはalternateの下のhrefにある
let array = articles[indexPath.row]["alternate"] as! NSArray
for roop in array {
let next = roop as! NSDictionary
//print(next["href"])
webView.url = next["href"] as? String
}
Swift - NSSingleObjectArrayIとは?|teratail
Swiftで日時文字列とUNIX時間を相互に変換する方法 - Qiita
// セルに表示する作成日を設定する
let tagsText = cell.viewWithTag(4) as! UILabel
let dateUnix = (article["published"]! as? Double)! / 1000 // items->creation_date
let date = NSDate(timeIntervalSince1970: dateUnix)
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
let dateStr: String = formatter.string(from: date as Date)
tagsText.text = author + " " + daysAgo(dateStr)
$ curl -H
continuation=publishedの値
publishedの値より前の記事を取得
https://cloud.feedly.com/v3/streams/contents?streamId=user/" + Constants.feedlyUserId + "/category/global.uncategorized&continuation=" + continuation
feedlyのCreate New Feedでcategoryを作成
Addで追加
$ curl -H "Authorization: OAuth yourAccessTokenValueGoesHere" https://cloud.feedly.com/v3/categories | jq
で、idのcategoryの後ろを確認
はてなブログ グループのRSSフィード - Sprint Life
Feedly にはてなブックマーク数を表示する Chrome 拡張 - yunica's blog
sandbox
Time ago extention
“Time ago” Date extension in Swift | by JD | Medium
【Swift】Substringを簡単にしたい | 2速で歩くヒト
func daysAgo(_ data: String) -> String {
let calendar = Calendar.current
let dateComponents = DateComponents(calendar: calendar, year: Int(data[0...3]), month: Int(data[5...6]), day: Int(data[8...9]), hour: Int(data[11...12]), minute: Int(data[14...15]), second: Int(data[17...18]))
if let date = calendar.date(from: dateComponents) {
return date.timeAgo()
}
return ""
}
// セルに表示する作成日を設定する
let textDetailText = cell.viewWithTag(3) as! UILabel
textDetailText.text = daysAgo((article["created_at"] as? String)!)
NSDate を相対時刻にするライブラリ - 大学生からの Web 開発
はてなブックマーク お気に入りフィードのタイトルを表示
Swift4でRSSリーダーをつくろう - @mizumotokのブログ
$ git clone https://github.com/mizumotok/rss-reader-swift4
Xcodeでxcodeprojファイルを開く
ViewController.swiftのfeedUrlを変更して実行
let feedUrl = URL(string: "https://b.hatena.ne.jp/fedora9/favorite.rss?key=xxxxxxxx")!
NoteのAPIでカテゴリがテクノロジーのタイトルを表示 を元に、
画面とViewControllerをコピーして、作成
https://b.hatena.ne.jp/fedora9/favorite
お気に入りフィードのURL
https://b.hatena.ne.jp/fedora9/favorite.rss?key=xxxxxxxx
HBFavが使えなくなったので代替策を考える - braitom's Tech Memo
Swiftの最新記事 RSS
http://b.hatena.ne.jp/search/tag?q=swift&users=1&mode=rss&page=1
https://b.hatena.ne.jp/search/tag?q=swift&users=1
Hotentry RSS
http://b.hatena.ne.jp/hotentry.rss
IT RSS
http://b.hatena.ne.jp/hotentry/it.rss
はてなブックマークお気に入りフィード仕様 - Hatena Developer Center
Consumer key を取得して OAuth 開発をはじめよう - Hatena Developer Center
until / of / with_me のパラメータは廃止されました。
お気に入りフィードRSSの継続および仕様変更について - はてなブックマーク開発ブログ
Safariでウェブページのソースコードを見る方法。(HTML & CSS)
RSS to JSON Converter online - rss2json.com
出力されるアイテムの数はデフォルト10
RSSをJSONに変換してくれるWebサービス「rss2json」の紹介 - Qiita
b.hatena.ne.jp/favorite.rss で検索
GitHub - YuheiNakasaka/RNHBFav: HBFavのReactNative版
MACアプリ
$ git clone https://github.com/Nyoho/HatebLine
$ cd HatebLine
$ carthage update --OSX
GitHub ActionsとGitHub PagesでつくるWeb API(郵便番号検索) - @mizumotokのブログ
RSSリーダ
SwiftでシンプルなRSSリーダーを作る(Yahooニュース編) - Qiita
$ git clone https://github.com/kawano108/YahooNewsMirror
$ cd YahooNewsMirror
$ pod install
Xcodeでxcworkspaceファイルを開き、実行
NewsType.swift
RSSはXMLでデータを返しますが、より汎用的に使えるJSONで記事を取得したいのでJSON変換するAPIを通しています。
SwiftだけでRSSリーダーを作ってみた - Eureka, Inc.