-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add twitch support #1017
Add twitch support #1017
Conversation
I added some code to cache the twitch client id, since it should never change. However, since it might change, the code tries to fetch the resource twice, once with the cached client id, and if it fails, again with a newly obtained client id that is then cached. |
@riccardobl On your test channel, https://www.twitch.tv/rblb0/, there is a ⚡ emoji on the contents of the page because you don't have recent streams, I used a different test page here https://www.twitch.tv/sedentarismo where the user only see the lightning address if navigating to the "About" page. Do you know if there is some setting that the content creator can use to always display the lightning address on the main channel page? |
Looking at the source code of the page with devtools, there is a |
It seems twitch is doing some sort of weird partial page update, if you try to open a video directly: https://www.twitch.tv/videos/1534401704 you'll see the twitter:description tag is not set to the channel bio, even if you navigate back to the about section or channel home. I've found another api ViewerFeedback_Creator that should work everywhere, however it needs the channel ID and i haven't found a way to obtain it from the streams pages yet. |
I've found a way to get the channel id, this should now work on all pages 2b6a015 |
} | ||
) | ||
)[0]; | ||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could simplify this condition with Typescript optional chaining. See:
https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#optional-chaining
if (channelData?.data?.video?.owner)
} | ||
) | ||
)[0]; | ||
if (channelData && channelData.data && channelData.data.userOrError) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also could apply optional chaining here.
yay, thanks for the PR! 🚀 |
Nice PR! Thanks @riccardobl 🚀 Just a few suggestions:
Also, is it possible to make an |
@riccardobl are you still working on this? |
Search for ln address in channel bio.
Test channel: https://www.twitch.tv/rblb0/