parse method

Future? parse(
  1. String link, [
  2. bool extra = false
])

Implementation

Future? parse(String link, [bool extra = false]) async {
  if (Detect().validate(link, "aniboom")) {
    try {
      final response = await _dio.get(
        link,
        options: Options(
          headers: {
            "Referer": "https://animego.org/",
            "Accept-Language": "ru-RU",
            "Origin": "https://aniboom.one",
            "User-Agent":
                "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36",
          },
        ),
      );
      final xpath = HtmlXPath.html(response.data.toString());
      final json = jsonDecode(
          xpath.query('//*[@id="video"]/@data-parameters').attrs[0]!);
      // эта хуйня возвращает целый комплект данных по плееру
      // если очень хочется включите extra
      final hls = jsonDecode(json["hls"]);
      if (!extra) {
        return Video(1080, "m3u8", hls["src"], _headers);
      } else {
        return json;
      }
    } on DioException {
      throw Exception("An error has occurred");
    }
  } else {
    throw BadDataException("Bad url!");
  }
}