1
전적으로 omniauth를 설정하고 YouTube 사용자의 일부 속성을 포함하여 여러 가지 다른 공급자 응답을 구문 분석 할 수는 있지만 YouTube 사용자의 채널 링크를 가져올 수 없습니다.Omniauth YouTube의 도움 구문 분석 응답
--- !ruby/hash:OmniAuth::AuthHash
provider: youtube
uid: http://gdata.youtube.com/feeds/api/users/DLjkduRouoiweRktkkl
info: !ruby/hash:OmniAuth::AuthHash::InfoHash
uid: http://gdata.youtube.com/feeds/api/users/DLjkduRouoiweRktkkl
nickname: Example User
email: [email protected]
first_name: Example
last_name: User
image: http://lh3.googleusercontent.com/-7vCkdsSDAfsU/AAAAAAAAAAA/kjRe3kjk/s88-c-k/photo.jpg
description:
location: Example City CA, US
channel_title: Example User
subscribers_count: '66'
credentials: !ruby/hash:Hashie::Mash
token: kh58.lkjASDF93-W2-ADFJkjfdo498_W8IWnjWTWY
expires_at: 1354004818
expires: true
extra: !ruby/hash:Hashie::Mash
user_hash: !ruby/hash:Hashie::Mash
xmlns: http://www.w3.org/2005/Atom
xmlns$media: http://search.yahoo.com/mrss/
xmlns$gd: http://schemas.google.com/g/2005
xmlns$yt: http://gdata.youtube.com/schemas/2007
id: !ruby/hash:Hashie::Mash
$t: http://gdata.youtube.com/feeds/api/users/DLjkduRouoiweRktkkl
published: !ruby/hash:Hashie::Mash
$t: '2012-02-14T23:39:43.000Z'
updated: !ruby/hash:Hashie::Mash
$t: '2012-11-27T06:07:22.000Z'
category:
- !ruby/hash:Hashie::Mash
scheme: http://schemas.google.com/g/2005#kind
term: http://gdata.youtube.com/schemas/2007#userProfile
title: !ruby/hash:Hashie::Mash
$t: Example User
type: text
content: !ruby/hash:Hashie::Mash
$t: Example user channel description
type: text
link:
- !ruby/hash:Hashie::Mash
rel: alternate
type: text/html
href: http://www.youtube.com/channel/kljasdSDAF98324
.
.
.
내가 내 사용자 모델에서이 작업을 수행하여 상단에있는 "별칭"같은 것들을 얻을 수 있습니다 :
다음 응답이 나는 마지막 줄에 링크를 얻기 위해 노력하고, 모습입니다def add_omniauth(auth)
user.name = auth["info"]["nickname"]
end
하지만 맨 아래에있는 URL은 어떻게 얻을 수 있습니까? 나는 시도했다 :
user.link = auth["extra"]["user_hash"]["link"]["href"]
그러나 아무 소용이 없다. 레일과 루비 초보자로서, 나는 도움을 주셔서 감사합니다.