Conversation
app/models/nico_link.rb
Outdated
# frozen_string_literal: true | ||
|
||
class NicoLink | ||
NICOLINK_RE = /(?<pre>^|[^\/\)\w])((?<id1>(ap|ar|az|ch|co|dw|im|jps|kn|lv|nc|nw|td)[0-9]+)|(?<id2>sm[0-9]+)(?<time>#[0-9]{1,2}:[0-5][0-9])?)/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id2(動画リンク)は sm の他にも so は少なくとも欲しいかな。厳密には昔のが他にもあるけど。あと lvもむしろ id2かな。時間アンカー付くので
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
後追いで是非対応IDを増やしていきたいですね!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
秒数指定を実装してみた
これはさすがにテスト欲しくなる |
4f60dd1
to
33bbcf8
Compare
こんな記事があったのか:http://dic.nicovideo.jp/a/id 時間アンカーはひとまず措いて
既に処理の最後に通っているようだけど、これとは違うものかな? |
app/models/nico_link.rb
Outdated
so | ||
].freeze | ||
|
||
NICOLINK_RE = %r{(?<prefix>^|[^\/\)\w])(?<nico_id>(#{ALL_TYPES.join('|')})[0-9]+)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
あぁこれ普通に \d+
でええやん
33bbcf8
to
9ee6c80
Compare
class NicoLink | ||
BASE_URI = URI.parse('https://nico.ms') | ||
|
||
TEMPORAL_TYPES = %w[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
巧いネーミングが思い付かなかった・・・(´・ω・`)
squashとrebaseよろー |
取り敢えず次の種類を実装する。 - 分秒可 - lv 生放送 - sm 動画 - so 公式動画 - 分秒無し - im 静画
c75b701
to
5ef59a2
Compare
✅ rebase |
thx :nicoru: |
Add some nicolinks!
FAQを基に作ったけどあまり詳しくないので、もし間違ったところあれば直します!ご指摘ください!
Issue #3