コミットを比較

...

3 コミット

作成者 SHA1 メッセージ 日付
みてるぞ a59ec2b417 #106 誤字 2025-12-30 12:36:13 +09:00
みてるぞ eef12a68d1 Merge remote-tracking branch 'origin/main' into '#106' 2025-12-30 12:30:14 +09:00
みてるぞ 9f10bc8467 #106 ニジラー情報なし 2025-09-07 19:21:33 +09:00
2個のファイルの変更13行の追加1行の削除
+7
ファイルの表示
@@ -56,6 +56,12 @@ class Tag < ApplicationRecord
end
end
def self.no_deerjikist
@no_deerjikist ||= Tag.find_or_initialize_by(name: 'ニジラー情報不詳') do |tag|
tag.category = 'meta'
end
end
def self.normalise_tags tag_names, with_tagme: true
tags = tag_names.map do |name|
pf, cat = CATEGORY_PREFIXES.find { |p, _| name.start_with?(p) } || ['', nil]
@@ -68,6 +74,7 @@ class Tag < ApplicationRecord
end
end
tags << Tag.tagme if with_tagme && tags.size < 10 && tags.none?(Tag.tagme)
tags << Tag.no_deerjikist if tags.all? { |t| t.category != 'deerjikist' }
tags.uniq
end
+6 -1
ファイルの表示
@@ -1,9 +1,11 @@
namespace :nico do
desc 'ニコニコ DB 同期'
task sync: :environment do
require 'json'
require 'nokogiri'
require 'open3'
require 'open-uri'
require 'nokogiri'
require 'set'
fetch_thumbnail = -> url do
html = URI.open(url, read_timeout: 60, 'User-Agent' => 'Mozilla/5.0').read
@@ -87,6 +89,9 @@ namespace :nico do
if kept_non_nico_ids.to_set != desired_non_nico_ids.to_set
desired_all_ids << Tag.bot.id
end
unless Tag.where(id: desired_all_ids).where(category: 'deerjikist').exists?
desired_all_ids << Tag.no_deerjikist.id
end
desired_all_ids.uniq!
sync_post_tags!(post, desired_all_ids)