Implementing custom parsers - mihaly044/streamscraper GitHub Wiki

Available parsers

Parsers are special classes that enables streamscraper to grab download links from streaming sites. There are three parsers have been already implemented:

  • RtlMostParser
  • Tv2Parser
  • MtvaParser

Using custom parsers

To implement your own parser for a custom site, first create a class that inherits from IParser and implement ParseAsync as follows:

public  async  Task<string> ParseAsync(string  uri)
{
   // Dowbnload HTML source of the page
   var  html  =  await  Downloader.DownloadString(uri);
   var  parsedString  =  "";
   // Do something with the html variable and put it into parsedString
   return  parsedString;
}

Register your parser with ParserFactory before you start using it. For example if your parser class name is MyCustomParser, then call:

ParserFactory.RegisterParser<MyCustomParser>("mycustomparser");

After you have registered your parser class, build the project and call streamscraper as follows:

./streamscraper download -p mycustomparser -u <url-to-parse> -o <save-path>
⚠️ **GitHub.com Fallback** ⚠️