プロジェクト

全般

プロフィール

バグ #624 » openimg-20131104.diff

hycon miyagi, 2013-11-04 00:33

差分を表示:

core/plugin/openimg/openimg.rb
def get_tag_by_attributes(tag)
attribute = {}
tag.each_matches(/([a-zA-Z0-9]+?)=(['"])(.*?)\2/){ |pair, pos|
tag.each_matches(/([^\s=]+)=(['"])(.*?)\2/){ |pair, pos|
key, val = pair[1], pair[3]
attribute[key] = val }
attribute.freeze end
......
t = fetch(url)
/^(http:\/\/[^\/]+\/)post(\/\d+)/ =~ t
if $~
imgurlresolver($1 + "image" + $2, 'id' => 'content-image')
imgurlresolver($1 + "image" + $2, {'tag' => 'img', 'id' => 'content-image', 'attribute' => 'data-src'})
else
warn "たんぶらの記事ページじゃないっぽい"
nil
core/plugin/openimg/pattern_file.json
}
},
"jigokuno.com": {
"url": "^http://jigokuno\\.com/\\?eid=\\d+$",
"url": "^http://jigokuno\\.com/\\?eid=\\d+",
"attribute": {
"src": {
"json_class": "Regexp",
......
"Tumblr image": {
"url": "^http://[-0-9a-z]+\\.tumblr\\.com/image/\\d+",
"attribute": {
"id": "content-image"
"id": "content-image",
"attribute": "data-src",
"tag": "img"
}
},
"はてなフォトライフ": {
(3-3/3)