scrapeAudiobookDetails method

Future<Map<String, String>> scrapeAudiobookDetails(
  1. String detailUrl
)

Implementation

Future<Map<String, String>> scrapeAudiobookDetails(String detailUrl) async {
  final response = await http.get(Uri.parse(detailUrl));
  final document = parse(response.body);

  final downloadLink = document
          .querySelector('.postComments a[href*="dload-now"]')
          ?.attributes['href'] ??
      '';

  // You'll need to modify this based on actual detail page structure
  final hashExtraction = downloadLink.split('dload-now?ll=').last;

  return {'hash': hashExtraction, 'downloadLink': '$baseUrl$downloadLink'};
}