Could not find match for config_patterns for certain urls
See original GitHub issueHi, I started using pyTube just recently and I am very happy with the functionality. I am using it to download music tracks from YouTube Music.
In most of my tests, it worked great, but with some urls I catch an exception:
pytube.exceptions.RegexMatchError: get_ytplayer_config: could not find match for config_patterns
For example it occurs with this track: https://www.youtube.com/watch?v=hbFQARBbZww
I am neither good at regex, nor do I really understand what to search for in the analyzed html. Do you maybe have a solution for this issue, or can you give me some hints about how to fix the issue myself?
Best regards, Lukas
Issue Analytics
- State:
- Created 3 years ago
- Comments:11
Top Results From Across the Web
pytube error - get_ytplayer_config: could not find match for ...
This error (RegexMatchError: get_ytplayer_config: could not find match for config_patterns) is due to Pytube known issue.
Read more >URL match patterns · Issue #373 · darkreader ... - GitHub
Implement user-friendly URL glob patterns with negation ability and some special behavior. Similar to globby, extension match patterns etc.
Read more >Match patterns in extension manifests - Mozilla - MDN Web Docs
Match patterns are a way to specify groups of URLs: a match pattern matches a specific set of URLs. They are used in...
Read more >Allow specific URL patterns - Firebase Help - Google Support
If you specify URL patterns, any URL that doesn't match one of the patterns will cause your Dynamic Links to return HTTP error...
Read more >Chrome Extensions Match patterns - Chrome Developers
The following table shows some valid patterns. Note: urn scheme is available since Chrome 91. Pattern, What it does, Examples of matching URLs....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I modified the file “extract.py” in line 187 with the following (keep attention to open-close variables):
and works like a charm!!!.
Hi, I spent an hour on it but found a solution, specially set up an account here to share it. In the pytube/extract.py file, add to the config_patterns list r"‘PLAYER_CONFIG’:\s*({.*})});" it’s supposed to look like this
config_patterns = [ r";ytplayer\.config\s*=\s*({.*?});", r";ytplayer\.config\s*=\s*({.+?});ytplayer", r";yt\.setConfig\(\{'PLAYER_CONFIG':\s*({.*})}\);", r";yt\.setConfig\(\{'PLAYER_CONFIG':\s*({.*})(,'EXPERIMENT_FLAGS'|;)", # noqa: E501 r"'PLAYER_CONFIG':\s*({.*})}\);", ]