evazion
2019-08-06 12:04:05 -05:00
parent a8896b664d
commit 7f482dc35b
3 changed files with 40 additions and 14 deletions

View File

@@ -363,20 +363,6 @@ class Post < ApplicationRecord
base_36_id = base_10_id.to_s(36)
"https://twitpic.com/#{base_36_id}"
# http://orig12.deviantart.net/9b69/f/2017/023/7/c/illustration___tokyo_encount_oei__by_melisaongmiqin-dawi58s.png
# http://pre15.deviantart.net/81de/th/pre/f/2015/063/5/f/inha_by_inhaestudios-d8kfzm5.jpg
# http://th00.deviantart.net/fs71/PRE/f/2014/065/3/b/goruto_by_xyelkiltrox-d797tit.png
# http://th04.deviantart.net/fs70/300W/f/2009/364/4/d/Alphes_Mimic___Rika_by_Juriesute.png
# http://fc02.deviantart.net/fs48/f/2009/186/2/c/Animation_by_epe_tohri.swf
# http://fc08.deviantart.net/files/f/2007/120/c/9/Cool_Like_Me_by_47ness.jpg
# http://fc08.deviantart.net/images3/i/2004/088/8/f/Blackrose_for_MuzicFreq.jpg
# http://img04.deviantart.net/720b/i/2003/37/9/6/princess_peach.jpg
when %r{\Ahttps?://(?:(?:fc|th|pre|orig|img|prnt)\d{2}|origin-orig)\.deviantart\.net/.+/(?<title>[a-z0-9_]+)_by_(?<artist>[a-z0-9_]+)-d(?<id>[a-z0-9]+)\.}i
artist = $~[:artist].dasherize
title = $~[:title].titleize.strip.squeeze(" ").tr(" ", "-")
id = $~[:id].to_i(36)
"https://www.deviantart.com/#{artist}/art/#{title}-#{id}"
# http://prnt00.deviantart.net/9b74/b/2016/101/4/468a9d89f52a835d4f6f1c8caca0dfb2-pnjfbh.jpg
# http://fc00.deviantart.net/fs71/f/2013/234/d/8/d84e05f26f0695b1153e9dab3a962f16-d6j8jl9.jpg
# http://th04.deviantart.net/fs71/PRE/f/2013/337/3/5/35081351f62b432f84eaeddeb4693caf-d6wlrqs.jpg
@@ -385,6 +371,9 @@ class Post < ApplicationRecord
id = $~[:id].to_i(36)
"https://deviantart.com/deviation/#{id}"
when Sources::Strategies::DeviantArt::ASSET
Sources::Strategies::DeviantArt.new(source).page_url_from_image_url || source
when %r{\Ahttp://www\.karabako\.net/images(?:ub)?/karabako_(\d+)(?:_\d+)?\.}i
"http://www.karabako.net/post/view/#{$1}"