Browse Source

Added an extra regex check to inject JS again each time the music page is visited. Fixes #40

pull/52/head
Samuel Attard 7 years ago
parent
commit
2634c16042
  1. 9
      Google Play Music/ResourceHandlerFactory.cs

9
Google Play Music/ResourceHandlerFactory.cs

@ -9,10 +9,15 @@ namespace Google_Play_Music
{
class GPMResouceHandlerFactory : IResourceHandlerFactory
{
private bool firstJSOnly = true;
private bool firstJSOnly = false;
public IResourceHandler GetResourceHandler(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request)
{
if (Regex.Match(request.Url, @".js", RegexOptions.IgnoreCase).Success && Regex.Match(request.Url, @"http", RegexOptions.IgnoreCase).Success && firstJSOnly)
// Every time we request the main GPM page allow another JS injection
if (Regex.Match(request.Url, @"^http[s]?://play\.google\.com/music/listen", RegexOptions.IgnoreCase).Success)
{
firstJSOnly = true;
}
if (Regex.Match(request.Url, @"\.js", RegexOptions.IgnoreCase).Success && Regex.Match(request.Url, @"http", RegexOptions.IgnoreCase).Success && firstJSOnly)
{
firstJSOnly = false;
using (WebClient webClient = new WebClient())

Loading…
Cancel
Save