Redirect dead bookmarks to archive.org
This commit is contained in:
@@ -3,7 +3,7 @@ require "que"
|
||||
|
||||
module Adamantium
|
||||
module Jobs
|
||||
class RemoveDeadBookmarks < Que::Job
|
||||
class ArchiveDeadBookmarks < Que::Job
|
||||
def run
|
||||
bookmark_repo = Admin::Container["repos.bookmark_repo"]
|
||||
|
||||
@@ -12,7 +12,7 @@ module Adamantium
|
||||
bookmarks.each do |bookmark|
|
||||
code = HTTParty.get(bookmark.url, follow_redirects: false).code
|
||||
if code >= 400
|
||||
bookmark_repo.archive(id: bookmark.id)
|
||||
bookmark_repo.update(bookmark.id, {url: "https://web.archive.org/web/*/#{bookmark.url}"})
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user