naari3 / otomad-search Goto Github PK
View Code? Open in Web Editor NEW音MADを検索するぞ
Home Page: https://otomad-search.vercel.app/
音MADを検索するぞ
Home Page: https://otomad-search.vercel.app/
userIdでフィルタしようとしたらスナップショット検索APIが使用されているっぽくて出来なかった
本来はまだコンテンツ検索APIが使用される想定
内部ではisSsというクエリパラメータを見てスナップショット検索を使うかどうか切り替えるはずだが、これがうまく動いていないと思われる
これを機にssに切り替えるのはありかもしれませんね
redisを使ったrate limitを実装する必要がある
規模感的にredislabの無料枠を使えるのではないかと思っています
画像のLazyLoadと画面内にあるタグだけリンクを更新するようにしているため react-on-screen
を使用している
TrackVisibility
というReactコンポーネントをに任意のFCを渡すことで、そのコンポーネントが画面内にあるかどうかを検知できる
現在の実装ではTrackVisibilityに即席の関数(FCですらない)を渡しており、そこでsetStateを呼び出すような実装になっており、ここで怒られが発生している(下記エラーログ参照)
筋としてはTrackVisibilityにまともなFCを渡せば良さそう(useEffect を使う必要がありそう)だが、自分のローカル環境だと明らかに反応が鈍く(???)なってしまったのと、現状動いているのでそのままにしている
Warning: Cannot update a component (`Thumbnail`) while rendering a different component (`TrackVisibility`). To locate the bad setState() call inside `TrackVisibility`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render
at TrackVisibility (http://localhost:3000/_next/static/chunks/pages/search.js:275091:28)
at Thumbnail (http://localhost:3000/_next/static/chunks/pages/search.js:2138:27)
at a
at div
at div
at div
at div
at _c (http://localhost:3000/_next/static/chunks/pages/search.js:3079:20)
at div
at _c (http://localhost:3000/_next/static/chunks/pages/search.js:2511:20)
at li
at ul
at http://localhost:3000/_next/static/chunks/pages/search.js:2927:21
at div
at main
at div
at Layout (http://localhost:3000/_next/static/chunks/pages/index.js?ts=1605943310586:602:27)
at Search (http://localhost:3000/_next/static/chunks/pages/search.js:319335:21)
at MyApp (http://localhost:3000/_next/static/chunks/pages/_app.js?ts=1605943310586:10704:24)
at ErrorBoundary (http://localhost:3000/_next/static/chunks/main.js?ts=1605943310586:781:47)
at ReactDevOverlay (http://localhost:3000/_next/static/chunks/main.js?ts=1605943310586:885:23)
at Container (http://localhost:3000/_next/static/chunks/main.js?ts=1605943310586:12909:5)
at AppContainer (http://localhost:3000/_next/static/chunks/main.js?ts=1605943310586:13386:24)
at Root (http://localhost:3000/_next/static/chunks/main.js?ts=1605943310586:13502:25)
https://blog.nicovideo.jp/niconews/143630.html
代替APIとしてスナップショット検索API v2を提示されているが、こちらに乗り換える時に懸念しなければならないことをまとめる
https://site.nicovideo.jp/search-api-docs/snapshot
動画のAPIとして見たときのパラメータやレスポンスはおおよそ同じだが細かい部分で違う箇所がある
つまりuserIdによる絞り込み、userIdの取得は出来ない
以下の通り。こんなに必要かどうかはちょっと疑問ではある
コンテンツ検索API: 1600
スナップショット検索API: 100000
このサービスは音MADが固定値なのであまり意味なし
このサービスでは使ってない
最新コメントが取れるらしい 多分検索結果に出てくる一行程度のコメントの集まり
使えるかも
このサービスでは使ってない
ロックされたタグが取れなくなる
使ってないが、使いたかったので残念
1日1回のみマスターデータが更新されるようになる
https://api.search.nicovideo.jp/api/v2/snapshot/version
ここを見るにおおよそ7~8時に更新されるらしく、それまでは同一パラメータに対して同じ結果しか返さない
ISRの機運?大量のパラメータの組み合わせに対してページ生成出来るのかどうかは要検証
短縮じゃない方をターゲットにしたユーザースクリプトがある
それが動くようになるかもしれない
いつのまにか対応できるようになっていた
ORで検索できるようにもしたい
「動いてないじゃん」って言われて帰る可能性が高い
https://otomad-search.vercel.app/search?_sort=-startTime&q=&viewCounterGte=1000000&startTimeLte=2013-01-01T00%3A00&page=1&per=100
時刻をクエリに追加する際に受け入れるフォーマットが変わったのではないか?
パッと見でなんなのかまったくわからなかったのでスルーしている
Warning: A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components
at input
at div
at div
at div
at form
at div
at SearchBar (http://localhost:3000/_next/static/chunks/pages/index.js?ts=1605943310586:845:95)
at div
at header
at Header (http://localhost:3000/_next/static/chunks/pages/index.js?ts=1605943310586:346:93)
at div
at Layout (http://localhost:3000/_next/static/chunks/pages/index.js?ts=1605943310586:602:27)
at Search (http://localhost:3000/_next/static/chunks/pages/search.js:319335:21)
at MyApp (http://localhost:3000/_next/static/chunks/pages/_app.js?ts=1605943310586:10704:24)
at ErrorBoundary (http://localhost:3000/_next/static/chunks/main.js?ts=1605943310586:781:47)
at ReactDevOverlay (http://localhost:3000/_next/static/chunks/main.js?ts=1605943310586:885:23)
at Container (http://localhost:3000/_next/static/chunks/main.js?ts=1605943310586:12909:5)
at AppContainer (http://localhost:3000/_next/static/chunks/main.js?ts=1605943310586:13386:24)
at Root (http://localhost:3000/_next/static/chunks/main.js?ts=1605943310586:13502:25)
あまりおかしいクエリを投げたくない
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.