Merge pull request #4277 from BrokenEagle/fix-pawoo-source
Fix Pawoo source
This commit is contained in:
@@ -50,6 +50,10 @@ class PawooApiClient
|
|||||||
def commentary
|
def commentary
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_h
|
||||||
|
json
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Status
|
class Status
|
||||||
@@ -97,15 +101,34 @@ class PawooApiClient
|
|||||||
commentary << json["content"]
|
commentary << json["content"]
|
||||||
commentary
|
commentary
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_h
|
||||||
|
json
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(url)
|
def get(url)
|
||||||
if id = Status.is_match?(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
|
end
|
||||||
|
|
||||||
if id = Account.is_match?(url)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ module Sources::Strategies
|
|||||||
return "https://pawoo.net/@#{$1}"
|
return "https://pawoo.net/@#{$1}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return url if api_response.profile_url.blank?
|
||||||
api_response.profile_url
|
api_response.profile_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user