Skip to content

Commit

Permalink
version 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gopi2401 committed Jan 13, 2024
1 parent d244ba6 commit b663989
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 27 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ A new instagram videos download app.
## Features
- Download Photos and Videos
- Story Saver
- Youtube Video Shorts
- Multiple Downloads
- Fast Downloads
- User-Friendly Interface
Expand Down
11 changes: 6 additions & 5 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
android:maxSdkVersion="33" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> -->
<!-- <uses-permission android:name="android.permission.VIBRATE" /> -->
<!-- <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" /> -->
Expand All @@ -10,12 +9,14 @@
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION"/>
<application
android:label="insta"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
android:requestLegacyExternalStorage="true">
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
61 changes: 56 additions & 5 deletions lib/Functions/insta_download.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
// ignore_for_file: file_names

import 'dart:convert';
import 'dart:io';
import 'dart:math';
import 'dart:ui';

import 'package:flutter/foundation.dart';
import 'package:flutter/foundation.dart' as foundation;
import 'package:get/get.dart';
import 'package:insta/Functions/fileDownload.dart';
import 'package:insta/main.dart';
import 'package:webview_flutter/webview_flutter.dart';

import 'package:encrypt/encrypt.dart' as encrypt;
import 'package:http/http.dart' as http;

import '../models/graphql.dart';
Expand All @@ -30,13 +32,41 @@ class InstaDownloadController extends GetxController {
final cook = await controller.runJavaScriptReturningResult(
'JSON.parse(document.documentElement.innerText)') as String;
var data = jsonDecode(cook);
debugPrint('Page finished loading: $cook');
postReel(data);
foundation.debugPrint('Page finished loading: $cook');
if (data['require_login'] != null && data['require_login']) {
var httpClient = new HttpClient();
var request = await httpClient.getUrl(
Uri.parse("https://backend.instavideosave.com/allinone"));
request.headers.add('url', encryptFun(link));
var response = await request.close();
if (response.statusCode == HttpStatus.OK) {
var json = await response.transform(utf8.decoder).join();
var data = jsonDecode(json);
if (data['video'] != null && data['video'].isNotEmpty) {
for (var file in data['video']) {
downloadController.downloadFile(
file['video'],
"ReelVideo-${Random().nextInt(900000) + 100000}",
file['thumbnail']);
}
}
if (data['image'] != null && data['image'].isNotEmpty) {
for (var url in data['image']) {
downloadController.downloadFile(url,
"ReelImage-${Random().nextInt(900000) + 100000}", url);
}
}
} else {
navigatorKey.currentState?.pushNamed('login');
}
} else {
postReel(data);
}
},
))
..loadRequest(Uri.parse(url));
} catch (e) {
debugPrint('downloadReal: $e');
foundation.debugPrint('downloadReal: $e');
}
}

Expand Down Expand Up @@ -107,4 +137,25 @@ class InstaDownloadController extends GetxController {
}
}
}

String encryptFun(String input) {
final key = encrypt.Key.fromUtf8('qwertyuioplkjhgf');
final iv = encrypt.IV.fromLength(16); // IV length is 16 for AES
final encrypter =
encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.ecb));
// Encrypt the input directly
final encrypted = encrypter.encrypt(input, iv: iv);
// Convert the encrypted bytes to a hex string
final encryptedHex = encrypted.base16;
return encryptedHex;
}

String nameFun(String input) {
var text = input
.toString()
.replaceAll(RegExp(r"[&/\\#,+()$~%.\':*?<>{}]+"), '')
.replaceAll("\n", "_")
.replaceAll("|", "_");
return text.length >= 60 ? text.substring(0, 60) : text;
}
}
33 changes: 18 additions & 15 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import 'package:insta/instagram_login_page.dart';
import 'package:insta/profilepage.dart';
import 'Functions/permission.dart';
import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:http/http.dart' as http;

DistribUrl downloadController = Get.put(DistribUrl());
Expand Down Expand Up @@ -275,20 +274,24 @@ class _MyHomePageState extends State<MyHomePage> {
// onPressed: () async =>
// {navigatorKey.currentState?.pushNamed('nextpage')},
// child: const Text('Next Page')),
ElevatedButton(
onPressed: () {
final snackBar = SnackBar(
content: Text('Hello World!'),
margin: EdgeInsets.all(20),
behavior: SnackBarBehavior.floating,
);

// Find the ScaffoldMessenger in the widget tree
// and use it to show a SnackBar.
ScaffoldMessenger.of(context).showSnackBar(snackBar);
},
child: const Text('Show SnackBar'),
),
// ElevatedButton(
// onPressed: () {
// final snackBar = SnackBar(
// content: Row(
// children: [
// CircularProgressIndicator(),
// SizedBox(width: 16),
// Text("Loading..."),
// ],
// ),
// duration: Duration(seconds: 2),
// );
// // Find the ScaffoldMessenger in the widget tree
// // and use it to show a SnackBar.
// ScaffoldMessenger.of(context).showSnackBar(snackBar);
// },
// child: const Text('Show SnackBar'),
// ),
],
),
),
Expand Down
5 changes: 3 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.5.0+1
version: 1.6.0+1

environment:
sdk: ">=3.1.0 <4.0.0"
Expand All @@ -41,13 +41,14 @@ dependencies:
path_provider: ^2.1.1
#image_gallery_saver: ^2.0.3
#get_storage: ^2.1.1
webview_flutter: ^4.2.4
font_awesome_flutter: ^10.5.0
fluttertoast: ^8.2.2
http: ^1.1.0
flutter_local_notifications: ^15.1.1
dio: ^5.4.0
permission_handler: ^11.0.1
webview_flutter: ^4.4.4
encrypt: ^5.0.0
dev_dependencies:
flutter_test:
sdk: flutter
Expand Down

0 comments on commit b663989

Please sign in to comment.