Skip to content

webbrowser.cdp: implement CDP connection #5388

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

Merged
merged 2 commits into from
Jul 3, 2023

Conversation

bastimeyer
Copy link
Member

@bastimeyer bastimeyer commented Jun 19, 2023

Part 3/4 of #5380

This currently includes the commits of #5381 (part 1) and #5386 (part 2), because this code is needed for the CDP connection stuff. Once those PRs have been merged into master, I will rebase this branch.

So the only relevant commits of this PR are the ones after the merge commit. See the check marks of the HEAD commits of those other branches.


This

  1. Adds the trio-websocket and typing-extensions runtime dependencies.
    • A bit unfortunate that we have to add another dependency for websockets, but it is what it is... Async I/O via trio is a requirement for a proper implementation.
    • typing-extensions is required, because I needed TypeAlias for making the CDPEventListener's typing work. This conveniently also adds Self and other things.
  2. Implements the CDP connection and session management.
    • As mentioned in Implement data extraction via web browser (Chrome devtools protocol) #5380, the basic design is borrowed from the trio-chrome-devtools-protocol project, which uses the MIT license. This is properly annotated with the included license text. I applied several improvements and fixes to the code. This is all fully tested with full coverage.
    • Trio 0.22 currently requires the from __future__ import annotations workaround so the memory channels can have proper typing information, which is important. This will be resolved in their next release (they are waiting for the EOL of py37), but I don't think it's worth removing the import and bumping the version requirement once it's released.

@bastimeyer
Copy link
Member Author

Rebased to current head of master, because this PR is the base branch for other PRs until it got merged into master.

@bastimeyer bastimeyer force-pushed the webbrowser/cdp/init branch 4 times, most recently from 1994d2f to 441c04d Compare June 29, 2023 00:41
@bastimeyer bastimeyer force-pushed the webbrowser/cdp/init branch from 441c04d to d22aa93 Compare July 3, 2023 16:05
@bastimeyer bastimeyer marked this pull request as ready for review July 3, 2023 16:05
@bastimeyer
Copy link
Member Author

Rebased to master (unrelated commits are now gone from the branch), added missing docs notes of the trio-websocket and typing-extensions dependencies, and removed backported import of AsyncMock (py37)

@bastimeyer bastimeyer merged commit 20c8b6b into streamlink:master Jul 3, 2023
@bastimeyer bastimeyer deleted the webbrowser/cdp/init branch July 3, 2023 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant