wayback_client 0.1.0 copy "wayback_client: ^0.1.0" to clipboard
wayback_client: ^0.1.0 copied to clipboard

A Dart client for the Internet Archive's Wayback Machine Save Page Now API. Easily archive web pages and check if snapshots are cached.

example/wayback_client_example.dart

import 'package:dio/dio.dart';
import 'package:wayback_client/wayback_client.dart';

Future<void> main() async {
  // 1. Set up a custom Dio client (with timeouts and headers)
  final dio = Dio(BaseOptions(connectTimeout: const Duration(seconds: 10)));

  // 2. Create the client with custom configuration
  final client = WaybackClient(
    dio: dio,
    maxRetries: 5, // Reduce retries for the example
    userAgent:
        'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
  );

  try {
    // 3. Archive a URL
    final (archiveUrl, isCached) = await client.saveUrl(
      'https://dart.dev/effective-dart',
    );

    print('📁 Result:');
    print('   - Snapshot URL: $archiveUrl');
    print('   - Content cached? ${isCached ? '✅ Yes' : '❌ No'}');
    print('   - You can view it at: $archiveUrl');
  } catch (e) {
    print('⚠️ Failed to archive the URL: $e');
  }
}
0
likes
160
points
9
downloads

Publisher

verified publishercorujadigital.tech

Weekly Downloads

A Dart client for the Internet Archive's Wayback Machine Save Page Now API. Easily archive web pages and check if snapshots are cached.

Repository (GitLab)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

dio

More

Packages that depend on wayback_client