-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstory
68 lines (61 loc) · 2.88 KB
/
story
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
static Future<InstaProfile> storyFromUrl(String userUrl) async {
InstaProfile _profileParsed = InstaProfile();
String _temporaryData = '';
int _startInx = 0, _endInx = 1;
Client _client = Client();
Response _response;
var _document, jsonData;
List<InstaStory> _storyData = [];
_profileParsed = await InstaData.userProfileData(userUrl);
if (_profileParsed != null) {
if (_profileParsed.isPrivate == false) {
String _patternStart = "{\"pageProps\":";
String _patternEnd = ",\"__N_SSP\":tru";
try {
String username = userUrl.replaceAll('https://www.instagram.com/', '');
username = username.replaceAll('https://instagram.com/', '');
username = username.replaceAll('/', '');
_response = await _client.get('https://storiesig.com/stories/$username');
_document = parse(_response.body);
_document = _document.querySelectorAll('body');
_temporaryData = _document[0].text;
_temporaryData = _temporaryData.trim();
_startInx = _temporaryData.indexOf(_patternStart) + _patternStart.length;
_endInx = _temporaryData.indexOf(_patternEnd);
_temporaryData = _temporaryData.substring(_startInx, _endInx);
jsonData = json.decode(_temporaryData);
// print(jsonData);
_profileParsed.storyCount = int.parse(jsonData['stories']['media_count'].toString());
for (var item in jsonData['stories']['items']) {
var date = DateTime.fromMillisecondsSinceEpoch(item['taken_at'] * 1000);
_storyData.add(InstaStory(
storyDate: date.toString(),
storyType: item['media_type'].toString() == '1' ? 'photo' : 'video',
storyHeight: item['original_height'].toString(),
storyWidth: item['original_width'].toString(),
storyThumbnail: item['image_versions2']['candidates'][0]['url'].toString(),
downloadUrl: item['media_type'].toString() == '1' ? item['image_versions2']['candidates'][0]['url'].toString() : item['video_versions'][0]['url'].toString(),
));
}
_profileParsed.storyData = _storyData;
} catch (error) {
print('[InstaData][storyFromUrl]: $error');
}
} else {
// Private Acc
return _profileParsed;
}
} else {
// Invaild URL
return null;
}
return _profileParsed;
}
}
// https://igs.sf-converter.com/api/userInfoByUsername/phoenix_queen_25
// https://igs.sf-converter.com/api/stories/50839057408
// https://igs.sf-converter.com/api/highlights/50839057408
// https://igs.sf-converter.com/api/highlightStories/highlight:17991492164446320
// https://api-ig.storiesig.info/api/highlights/4744334141
// https://api-ig.storiesig.info/api/highlightStories/highlight:17991492
// https://api.akuari.my.id/downloader/yt1?link=