Skip to content
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

Support twitch #68

Open
mscheltienne opened this issue Feb 12, 2024 · 5 comments
Open

Support twitch #68

mscheltienne opened this issue Feb 12, 2024 · 5 comments

Comments

@mscheltienne
Copy link

It should be possible to support twitch as well?
If you can give me a couple of hints/guidance, I can open a PR to add the functionality.

@dham
Copy link
Collaborator

dham commented Feb 12, 2024

Thanks for the offer. These are the things you need to do to add a new platform:

  1. Add a module to youtube/sphinxcontrib/youtube following the pattern of youtube.py, vimeo.py and peertube.py. This will contain subclasses of utils.video and utils.Video which set whichever parameters are different for your platform from the default.
  2. Register the new classes in __init__.py.
  3. Add basic tests following the pattern for the other platforms.
  4. Add documentation to README.md and the RST files in the docs folder. Again, follow the pattern for other platforms.

@mscheltienne
Copy link
Author

mscheltienne commented Feb 13, 2024

Twitch requires the parent domain.. I am actually unable to include a .. raw:: directives which works locally through file:///. Example directive which works:

        .. raw:: html

            <div style="text-align: center;">
                <iframe
                    src="https://player.twitch.tv/?video=1950152310&parent=mscheltienne.github.io&parent=well-play-teen.org&autoplay=false"
                    allowfullscreen
                    frameborder="0"
                    height="378"
                    scrolling="no"
                    width="620">
                </iframe>
            </div>

I don't see an easy way to get the parent as part of this extension.. any idea?

@dham
Copy link
Collaborator

dham commented Feb 13, 2024

I think you do the following.

  1. When you subclass Video, overwrite option_spec with one that adds a parent option.
  2. Write a wrapper for utils.visit_video_node_html which adds the right string based on parent into url_parameters. If you look at youtube.py then you can see such a wrapper.

@mscheltienne
Copy link
Author

mscheltienne commented Feb 13, 2024

But we don't have a way to retrieve the domain (to complete the parent) dynamically. I guess the only option is a configuration key, e.g. 'twitch_parent'.

@dham
Copy link
Collaborator

dham commented Feb 13, 2024

At the point that sphinx runs, it has no way of knowing where the resulting html will be hosted. I think that you're right that it needs to go in conf.py, because it's global.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants