Commit 01e42b70 authored by evazion's avatar evazion Committed by GitHub

Merge pull request #4277 from BrokenEagle/fix-pawoo-source

Fix Pawoo source
parents 094b9e6d 0569e834
......@@ -50,6 +50,10 @@ class PawooApiClient
def commentary
nil
end
def to_h
json
end
end
class Status
......@@ -97,15 +101,34 @@ class PawooApiClient
commentary << json["content"]
commentary
end
def to_h
json
end
end
def get(url)
if id = Status.is_match?(url)
return Status.new(JSON.parse(access_token.get("/api/v1/statuses/#{id}").body))
begin
data = JSON.parse(access_token.get("/api/v1/statuses/#{id}").body)
rescue
data = {
"account" => {},
"media_attachments" => [],
"tags" => [],
"content" => "",
}
end
return Status.new(data)
end
if id = Account.is_match?(url)
return Account.new(JSON.parse(access_token.get("/api/v1/accounts/#{id}").body))
begin
data = JSON.parse(access_token.get("/api/v1/accounts/#{id}").body)
rescue
data = {}
end
return Account.new(data)
end
end
......
......@@ -48,6 +48,7 @@ module Sources::Strategies
return "https://pawoo.net/@#{$1}"
end
return url if api_response.profile_url.blank?
api_response.profile_url
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment