├── .gitattributes
├── .gitignore
├── InstagramPrivateAPI.csproj
├── InstagramPrivateAPI.sln
├── Program.cs
├── README.md
└── src
├── Actions.cs
├── Client.cs
├── Constants.cs
├── Globals.cs
├── models
├── direct
│ ├── DirectStory.cs
│ ├── IGThread.cs
│ ├── Inbox.cs
│ ├── IndoxThread.cs
│ └── item
│ │ ├── ThreadItem.cs
│ │ └── ThreadRavenMediaItem.cs
├── discover
│ ├── Cluster.cs
│ └── SectionalItem.cs
├── feed
│ └── Reel.cs
├── friendships
│ ├── FriendRequests.cs
│ └── Friendship.cs
├── live
│ ├── Broadcast.cs
│ └── Info.cs
├── location
│ └── Location.cs
├── media
│ ├── CarouselMedia.cs
│ ├── ImageVersions2.cs
│ ├── Media.cs
│ ├── Thumbnails.cs
│ ├── UserTags.cs
│ ├── Viewer.cs
│ ├── reel
│ │ ├── BlockedReels.cs
│ │ └── ReelMedia.cs
│ ├── thread
│ │ └── ThreadMedia.cs
│ ├── timeline
│ │ ├── Comment.cs
│ │ └── TimelineMedia.cs
│ └── video
│ │ └── VideoVersion.cs
├── news
│ └── NewsStory.cs
├── tags
│ ├── Info.cs
│ └── Tag.cs
└── user
│ ├── Besties.cs
│ ├── Profile.cs
│ └── User.cs
├── requests
├── Account.cs
├── Direct.cs
├── Discover.cs
├── Hashtag.cs
├── Internal.cs
├── Live.cs
├── Location.cs
├── Map.cs
├── Media.cs
├── People.cs
├── Request.cs
├── Story.cs
└── Timeline.cs
├── responses
├── Response.cs
├── accounts
│ ├── AccountsUserResponse.cs
│ ├── CheckUsernameResponse.cs
│ └── LoginResponse.cs
├── challenge
│ └── Challenge.cs
├── direct
│ ├── DirectGetPresenceResponse.cs
│ ├── DirectInboxResponse.cs
│ └── ThreadResponse.cs
├── discover
│ └── DiscoverTopicalExploreResponse.cs
├── feed
│ ├── FeedLocationResponse.cs
│ ├── FeedReelsTrayResponse.cs
│ ├── FeedTagResponse.cs
│ ├── FeedTimelineResponse.cs
│ ├── FeedUserReelsMediaResponse.cs
│ ├── FeedUserStoryResponse.cs
│ └── FeedUsersResponse.cs
├── friendships
│ ├── FreindshipStatusResponse.cs
│ ├── FreindshipsFollowersResponse.cs
│ ├── FreindshipsFollowingResponse.cs
│ └── FreindshipsShowResponse.cs
├── live
│ ├── LiveBroadcastCommentResponse.cs
│ ├── LiveBroadcastGetCommentResponse.cs
│ ├── LiveBroadcastGetViewerListResponse.cs
│ ├── LiveBroadcastHeartbeatResponse.cs
│ ├── LiveBroadcastLikeResponse.cs
│ ├── LiveBroadcastThumbnailsResponse.cs
│ ├── LiveCreateResponse.cs
│ ├── LiveInfoResponse.cs
│ ├── LiveJoinRequestsResponse.cs
│ ├── LiveQuastionStatusResponse.cs
│ └── LiveStartResponse.cs
├── location
│ ├── LocationInfoResponse.cs
│ └── LocationSearchResponse.cs
├── media
│ ├── MediaCommentResponse.cs
│ ├── MediaCommentsResponse.cs
│ ├── MediaInfoResponse.cs
│ └── MediaListReelMediaViewerResponse.cs
├── news
│ └── NewsInboxResponse.cs
├── tags
│ ├── TagsInfoResponse.cs
│ ├── TagsSearchResponse.cs
│ └── TagsSuggestedResponse.cs
└── users
│ ├── UserFollowingTagsResponse.cs
│ ├── UserReelSettingsResponse.cs
│ ├── UserResponse.cs
│ ├── UsersBlockedListResponse.cs
│ └── UsersSearchResponse.cs
└── utils
├── Devices
└── GoodDevices.cs
└── Signatures.cs
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Oo]ut/
33 | [Ll]og/
34 | [Ll]ogs/
35 |
36 | # Visual Studio 2015/2017 cache/options directory
37 | .vs/
38 | # Uncomment if you have tasks that create the project's static files in wwwroot
39 | #wwwroot/
40 |
41 | # Visual Studio 2017 auto generated files
42 | Generated\ Files/
43 |
44 | # MSTest test Results
45 | [Tt]est[Rr]esult*/
46 | [Bb]uild[Ll]og.*
47 |
48 | # NUnit
49 | *.VisualState.xml
50 | TestResult.xml
51 | nunit-*.xml
52 |
53 | # Build Results of an ATL Project
54 | [Dd]ebugPS/
55 | [Rr]eleasePS/
56 | dlldata.c
57 |
58 | # Benchmark Results
59 | BenchmarkDotNet.Artifacts/
60 |
61 | # .NET Core
62 | project.lock.json
63 | project.fragment.lock.json
64 | artifacts/
65 |
66 | # ASP.NET Scaffolding
67 | ScaffoldingReadMe.txt
68 |
69 | # StyleCop
70 | StyleCopReport.xml
71 |
72 | # Files built by Visual Studio
73 | *_i.c
74 | *_p.c
75 | *_h.h
76 | *.ilk
77 | *.meta
78 | *.obj
79 | *.iobj
80 | *.pch
81 | *.pdb
82 | *.ipdb
83 | *.pgc
84 | *.pgd
85 | *.rsp
86 | *.sbr
87 | *.tlb
88 | *.tli
89 | *.tlh
90 | *.tmp
91 | *.tmp_proj
92 | *_wpftmp.csproj
93 | *.log
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio LightSwitch build output
298 | **/*.HTMLClient/GeneratedArtifacts
299 | **/*.DesktopClient/GeneratedArtifacts
300 | **/*.DesktopClient/ModelManifest.xml
301 | **/*.Server/GeneratedArtifacts
302 | **/*.Server/ModelManifest.xml
303 | _Pvt_Extensions
304 |
305 | # Paket dependency manager
306 | .paket/paket.exe
307 | paket-files/
308 |
309 | # FAKE - F# Make
310 | .fake/
311 |
312 | # CodeRush personal settings
313 | .cr/personal
314 |
315 | # Python Tools for Visual Studio (PTVS)
316 | __pycache__/
317 | *.pyc
318 |
319 | # Cake - Uncomment if you are using it
320 | # tools/**
321 | # !tools/packages.config
322 |
323 | # Tabs Studio
324 | *.tss
325 |
326 | # Telerik's JustMock configuration file
327 | *.jmconfig
328 |
329 | # BizTalk build output
330 | *.btp.cs
331 | *.btm.cs
332 | *.odx.cs
333 | *.xsd.cs
334 |
335 | # OpenCover UI analysis results
336 | OpenCover/
337 |
338 | # Azure Stream Analytics local run output
339 | ASALocalRun/
340 |
341 | # MSBuild Binary and Structured Log
342 | *.binlog
343 |
344 | # NVidia Nsight GPU debugger configuration file
345 | *.nvuser
346 |
347 | # MFractors (Xamarin productivity tool) working folder
348 | .mfractor/
349 |
350 | # Local History for Visual Studio
351 | .localhistory/
352 |
353 | # BeatPulse healthcheck temp database
354 | healthchecksdb
355 |
356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
357 | MigrationBackup/
358 |
359 | # Ionide (cross platform F# VS Code tools) working folder
360 | .ionide/
361 |
362 | # Fody - auto-generated XML schema
363 | FodyWeavers.xsd
--------------------------------------------------------------------------------
/InstagramPrivateAPI.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net6.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/InstagramPrivateAPI.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.1.32407.343
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstagramPrivateAPI", "InstagramPrivateAPI.csproj", "{C808FBCA-E717-4F41-814A-1629AE8D5713}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {C808FBCA-E717-4F41-814A-1629AE8D5713}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {C808FBCA-E717-4F41-814A-1629AE8D5713}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {C808FBCA-E717-4F41-814A-1629AE8D5713}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {C808FBCA-E717-4F41-814A-1629AE8D5713}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {37F574FA-D877-4E3F-84E7-0966108F0251}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Program.cs:
--------------------------------------------------------------------------------
1 | using InstagramPrivateAPI.src;
2 |
3 | Client client = new Client();
4 | String username = "";
5 | string password = "";
6 | client.Login(username, password);
7 |
8 | Console.WriteLine(client.timeline.GetTimelineFeed());
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Instagram Private API
2 | ## Terms and conditions
3 | - Use this Api at your own risk.
4 | - Please don't use this library for sending spam or massive direct messages.
5 |
--------------------------------------------------------------------------------
/src/Actions.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 |
3 | namespace InstagramPrivateAPI.src
4 | {
5 | internal class Actions
6 | {
7 | private Client client;
8 | public Actions(Client c)
9 | {
10 | client = c;
11 | }
12 | public void UnFollowAll()
13 | {
14 | var following = client.people.GetFollowing(Globals.username_id);
15 |
16 | foreach (var user in following.users)
17 | {
18 | client.people.Unfollow(user.pk.ToString());
19 | Console.WriteLine($"[{DateTime.Now}] UnFollow user: {user.username}");
20 | Thread.Sleep(new Random().Next(15, 30) * 100);//1500-3000
21 | }
22 | }
23 |
24 | public void LikeAllUserMedia(String username, string max_id = null)
25 | {
26 | var timeline = client.timeline.GetUserFeed(client.people.GetUserId(username), max_id);
27 |
28 | foreach (var media in timeline.items)
29 | {
30 | if (!media.has_liked)
31 | {
32 | client.media.Like(media.id);
33 | Console.WriteLine($"[{DateTime.Now}] Like media: {media.code}");
34 | Thread.Sleep(1500);
35 | }
36 | }
37 |
38 | if ((bool)timeline.more_available)
39 | {
40 | max_id = timeline.next_max_id.ToString();
41 | LikeAllUserMedia(username, max_id);
42 | }
43 | }
44 | public void LikeAllMediaTimline(string max_id = null)
45 | {
46 | var timeline = client.timeline.GetTimelineFeed(max_id);
47 |
48 | foreach (var media in timeline.items)
49 | {
50 | if (!(bool)media.has_liked)
51 | {
52 | client.media.Like(media.id);
53 | Console.WriteLine($"[{DateTime.Now}] Like madia: {media.code}");
54 | Thread.Sleep(1500);
55 | }
56 | }
57 |
58 | if (timeline.auto_load_more_enabled && timeline.more_available)
59 | LikeAllMediaTimline(timeline.next_max_id);
60 | }
61 | public void UnfollowFollowers()
62 | {
63 | var following = client.people.GetFollowing(Globals.username_id);
64 | foreach (var user in following.users)
65 | {
66 | string pk = user.pk.ToString();
67 | var freindShip = client.people.GetFriendship(pk);
68 | if (!freindShip.friendship.followed_by)
69 | {
70 | client.people.Unfollow(pk);
71 | Console.WriteLine($"[{DateTime.Now}] UnFollow user: {user.username}");
72 | Thread.Sleep(1500);
73 | }
74 | }
75 | }
76 | public void Followed_by()
77 | {
78 | var followers = client.people.GetFollowers(Globals.username_id);
79 | var following = client.people.GetFollowing(Globals.username_id);
80 |
81 | Dictionary map = new Dictionary();
82 |
83 | int counter = 0;
84 | foreach (var user in followers.users)
85 | map.Add(counter++, user.pk.ToString());
86 |
87 | foreach (var user in following.users)
88 | {
89 | if (!map.ContainsValue(user.pk.ToString()))
90 | Console.WriteLine(user.username);
91 | }
92 | }
93 | public void WatchAllStories()
94 | {
95 | var reels = client.story.getReelsTrayFeed().tray;
96 |
97 | foreach (var tray in reels)
98 | {
99 | var user_pk = tray.user.pk;
100 | var items = client.story.getUserStoryFeed(user_pk.ToString()).reel.items;
101 |
102 | foreach (var item in items)
103 | {
104 | string itemSourceId = item.pk.ToString();
105 | string itemId = item.id.ToString();
106 | string itemTakenAt = item.taken_at.ToString();
107 |
108 | client.story.markMediaSeen(itemSourceId, itemId, itemTakenAt);
109 | //Thread.Sleep(1500);
110 | }
111 | }
112 | }
113 | public void DownloadUserMedia(string folder, string username, string max_id = null)
114 | {
115 | var feed = client.timeline.GetUserFeed(client.people.GetUserId(username));
116 |
117 | string file_name = null;
118 | string file_format = null;
119 | string url = null;
120 | string code = null;
121 |
122 | foreach (var item in feed.items)
123 | {
124 | int media_type = item.media_type;
125 | switch (media_type)
126 | {
127 | //Pic
128 | case 1:
129 | code = item.code.ToString();
130 | url = item.image_versions2.candidates[0].url.ToString();
131 | file_format = item.image_versions2.candidates[0].url.ToString().Split('.')[6].Split('?')[0];
132 | file_name = item.image_versions2.candidates[0].url.ToString().Split('.')[5].Split('/')[1].Split('.')[0];
133 | break;
134 | //Video
135 | case 2:
136 | code = item.code.ToString();
137 | url = item.video_versions[0].url.ToString();
138 | file_format = item.video_versions[0].url.ToString().Split('.')[6].Split('?')[0];
139 | file_name = item.video_versions[0].url.ToString().Split('.')[5].Split('/')[1];
140 | break;
141 | //album
142 | case 8:
143 | code = item.code.ToString();
144 |
145 | foreach (var media in item.carousel_media)
146 | {
147 | //Video
148 | if (media.media_type == 2)
149 | {
150 | url = media.video_versions[0].url.ToString();
151 | file_format = media.video_versions[0].url.ToString().Split('.')[6].Split('?')[0];
152 | file_name = media.video_versions[0].url.ToString().Split('.')[5].Split('/')[1];
153 | }
154 | //Pic
155 | else if (media.media_type == 1)
156 | {
157 | url = media.image_versions2.candidates[0].url.ToString();
158 | file_format = media.image_versions2.candidates[0].url.ToString().Split('.')[6].Split('?')[0];
159 | file_name = media.image_versions2.candidates[0].url.ToString().Split('.')[5].Split('/')[1].Split('.')[0];
160 | }
161 | new WebClient().DownloadFile(url.ToString(), folder + file_name + "." + file_format);
162 | }
163 |
164 | break;
165 | }
166 |
167 | new WebClient().DownloadFile(url.ToString(), folder + file_name + "." + file_format);
168 | Console.WriteLine("Downloaded: " + code);
169 |
170 | }
171 |
172 | if (feed.more_available)
173 | DownloadUserMedia(folder, username, feed.next_max_id);
174 |
175 | Console.WriteLine("Finished");
176 | }
177 | public void DownloadUserStory(string folder, string username)
178 | {
179 | var storyFeed = client.story.getUserStoryFeed(client.people.GetUserId(username));
180 |
181 | var items = storyFeed.reel.items;
182 |
183 | foreach (var item in items)
184 | {
185 | string file_name = null;
186 | string file_format = null;
187 | string url = null;
188 | string code = item.code;
189 |
190 | //Image
191 | if (item.media_type == 1)
192 | {
193 | url = item.image_versions2.candidates[0].url.ToString();
194 | file_format = item.image_versions2.candidates[0].url.ToString().Split('.')[6].Split('?')[0];
195 | file_name = item.image_versions2.candidates[0].url.ToString().Split('.')[5].Split('/')[2];
196 | }
197 | //Video
198 | else if (item.media_type == 2)
199 | {
200 | url = item.video_versions[0].url.ToString();
201 | file_format = item.video_versions[0].url.ToString().Split('.')[5].Split('?')[0];
202 | file_name = item.image_versions2.candidates[0].url.ToString().Split('.')[5].Split('/')[1];
203 | }
204 | new WebClient().DownloadFile(url.ToString(), folder + file_name + "." + file_format);
205 | Console.WriteLine("Downloaded: " + code);
206 | }
207 | }
208 | public void GetUserStory(string user_pk)
209 | {
210 | var story = client.story.getUserStoryFeed(user_pk);
211 |
212 | foreach (var item in story.reel.items)
213 | {
214 | //Image
215 | if (item.media_type == 1)
216 | {
217 | DateTime time = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
218 | time = time.AddSeconds(item.taken_at).ToLocalTime();
219 | Console.WriteLine($"Image:[{time}]\n" + item.image_versions2.candidates[0].url + "\n");
220 | }
221 | //Video
222 | else if (item.media_type == 2)
223 | {
224 | DateTime time = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
225 | time = time.AddSeconds((int)item.taken_at).ToLocalTime();
226 | Console.WriteLine($"Video [{time}]:\n" + item.video_versions[0].url + "\n");
227 | }
228 | }
229 | }
230 | }
231 | }
232 |
--------------------------------------------------------------------------------
/src/Client.cs:
--------------------------------------------------------------------------------
1 | using InstagramPrivateAPI.src.requests;
2 | using InstagramPrivateAPI.src.responses;
3 | using InstagramPrivateAPI.src.responses.accounts;
4 | using InstagramPrivateAPI.src.utils;
5 | using Newtonsoft.Json.Linq;
6 |
7 | namespace InstagramPrivateAPI.src
8 | {
9 | internal class Client
10 | {
11 | public LoginResponse Login(string username, string password, bool use_cookie = true, string cookie_fname = "cookie_data.txt", string session_fname = "session.txt", bool force = false)
12 | {
13 | LoginResponse login = null;
14 |
15 | Globals.uuid = Signatures.generateUUID(true);
16 | Globals.advertising_id = Signatures.generateUUID(true);
17 | Globals.phone_id = Signatures.generateUUID(true);
18 | Globals.device_id = Signatures.generateDeviceId(username + password);
19 |
20 | bool cookie_is_loaded = false;
21 | if (use_cookie)
22 | {
23 | try
24 | {
25 | JObject o = JObject.Parse(Request.LoadCookiesData(cookie_fname));
26 | Globals.csrftoken = o["csrftoken"].ToString();
27 | Globals.username_id = o["ds_user_id"].ToString();
28 | Globals.rank_token = Globals.username_id + "_" + Globals.uuid;
29 | Globals.token = Globals.csrftoken;
30 |
31 | Request.ReadCookies(session_fname);
32 |
33 | cookie_is_loaded = true;
34 | Globals.isLoggedIn = true;
35 | }
36 | catch
37 | {
38 | Console.WriteLine("The cookie is not found");
39 | }
40 | }
41 |
42 | if (!cookie_is_loaded && !(Globals.isLoggedIn || force))
43 | {
44 | dynamic data = new JObject();
45 | data.country_codes = "[{\"country_code\":\"1\",\"source\":[\"default\"]}]";
46 | data.phone_id = Globals.phone_id;
47 | data._csrftoken = Globals.csrftoken;
48 | data.username = username;
49 | data.adid = Globals.advertising_id;
50 | data.guid = Globals.uuid;
51 | data.device_id = Globals.device_id;
52 | data.password = password;
53 | data.google_tokens = "[]";
54 | data.login_attempt_count = "0";
55 |
56 | login = Request.Send("accounts/login/", data.ToString(), true);
57 |
58 | if (login.status.Equals("ok"))
59 | {
60 | Globals.isLoggedIn = true;
61 | try
62 | {
63 | Globals.username_id = login.logged_in_user.pk.ToString();
64 | Globals.rank_token = Globals.username_id + "_" + Globals.uuid;
65 | Globals.token = Globals.csrftoken;
66 | }
67 | catch { }
68 |
69 | if (use_cookie)
70 | Request.UseCookies();
71 |
72 |
73 | Console.WriteLine("Login success!");
74 | }
75 | }
76 | return login;
77 | }
78 |
79 | public Object Logout() => Request.Send("accounts/logout/");
80 |
81 | public Account account = new Account();
82 | public Direct direct = new Direct();
83 | public Discover discover = new Discover();
84 | public Hashtag hashtag = new Hashtag();
85 | public Live live = new Live();
86 | public Location location = new Location();
87 | public Media media = new Media();
88 | public People people = new People();
89 | public Story story = new Story();
90 | public Timeline timeline = new Timeline();
91 | public Map map = new Map();
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/src/Constants.cs:
--------------------------------------------------------------------------------
1 | using InstagramPrivateAPI.src.utils.Devices;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace InstagramPrivateAPI.src
9 | {
10 | internal class Constants
11 | {
12 | public static readonly string[] API_URLS = { "https://i.instagram.com/api/v1/", "https://i.instagram.com/api/v2/" };
13 | public static readonly string GRAPH_URL = "https://graph.instagram.com/";
14 | public static readonly string IG_VERSION = "121.0.0.29.119";
15 | public static readonly string VERSION_CODE = "185203708";
16 | public static readonly string IG_SIG_KEY = "9193488027538fd3450b83b7d05286d4ca9599a0f7eeed90d8c85925698a05dc";
17 | public static readonly string EXPERIMENTS = "ig_android_push_notifications_settings_redesign_universe,ig_hashtag_display_universe,ig_android_video_ssim_fix_pts_universe,coupon_price_test_ad4ad_instagram_resurrection_universe,ig_android_live_rendering_looper_universe,ig_shopping_checkout_improvements_universe,ig_android_mqtt_cookie_auth_memcache_universe,ig_android_optional_contact_and_preset_universe,ig_android_video_player_memory_leaks,ig_android_stories_seen_state_serialization,ig_stories_photo_time_duration_universe,ig_android_bitmap_cache_executor_size,ig_android_stories_music_search_typeahead,android_ard_ig_use_brotli_effect_universe,ig_android_remove_fb_nux_universe,ig_android_delayed_comments,ig_android_direct_mutation_manager_media_3,ig_smb_ads_holdout_2019_h1_universe,ig_fb_graph_differentiation,ig_android_stories_share_extension_video_segmentation,ig_android_igtv_crop_top,ig_android_stories_create_flow_favorites_tooltip,ig_android_direct_reshare_chaining,ig_android_stories_no_inflation_on_app_start,ig_android_stories_viewer_viewpoint_universe,ig_android_separate_empty_feed_su_universe,ig_android_zero_rating_carrier_signal,ig_direct_holdout_h1_2019,ig_explore_2019_h1_destination_cover,ig_android_direct_stories_in_direct_inbox,ig_android_explore_recyclerview_universe,ig_android_show_muted_accounts_page,ig_android_vc_service_crash_fix_universe,ig_camera_android_subtle_filter_universe,ig_android_lazy_init_live_composer_controller,ig_fb_graph_differentiation_no_fb_data,ig_android_viewpoint_stories_public_testing,ig_camera_android_api_rewrite_universe,ig_android_growth_fci_team_holdout_universe,android_camera_core_cpu_frames_sync,ig_android_video_source_sponsor_fix,ig_android_save_all,ig_android_ttcp_improvements,ig_android_camera_ar_platform_profile_universe,ig_android_separate_sms_n_email_invites_setting_universe,ig_shopping_bag_universe,ig_ar_shopping_camera_android_universe,ig_android_recyclerview_binder_group_enabled_universe,ig_android_stories_viewer_tall_android_cap_media_universe,ig_android_video_exoplayer_2,native_contact_invites_universe,ig_android_stories_seen_state_processing_universe,ig_android_dash_script,ig_android_insights_media_hashtag_insight_universe,ig_android_search_qpl_switch,ig_camera_fast_tti_universe,ig_android_igtv_improved_search,ig_android_stories_music_filters,ig_android_render_thread_memory_leak_holdout,ig_android_automated_logging,ig_android_viewmaster_post_capture_universe,ig_android_2018_h1_hashtag_report_universe,ig_android_camera_effect_gallery_prefetch,ig_share_to_story_toggle_include_shopping_product,ig_android_interactions_verified_badge_on_comment_details,ig_android_fix_ppr_thumbnail_url,ig_android_camera_reduce_file_exif_reads,ig_interactions_project_daisy_creators_universe,ig_payments_billing_address,ig_android_fs_new_gallery_hashtag_prompts,ig_camera_android_gyro_senser_sampling_period_universe,ig_android_xposting_feed_to_stories_reshares_universe,ig_android_combined_consumption,ig_camera_remove_display_rotation_cb_universe,ig_android_interactions_migrate_inline_composer_to_viewpoint_universe,ig_android_ufiv3_holdout,ig_android_neue_igtv_profile_tab_rollout,ig_android_enable_zero_rating,ig_android_story_ads_carousel_performance_universe_1,ig_android_direct_leave_from_group_message_requests,ig_android_import_page_post_after_biz_conversion,ig_camera_ar_effect_attribution_position,ig_promote_add_payment_navigation_universe,ig_android_story_ads_carousel_performance_universe_2,ig_android_main_feed_refresh_style_universe,ig_stories_engagement_holdout_2019_h1_universe,ig_android_story_ads_performance_universe_1,ig_android_stories_viewer_modal_activity,ig_android_story_ads_performance_universe_2,ig_android_publisher_stories_migration,ig_android_story_ads_performance_universe_3,ig_android_quick_conversion_universe,ig_android_story_import_intent,ig_android_story_ads_performance_universe_4,instagram_android_profile_follow_cta_context_feed,ig_biz_graph_connection_universe,ig_android_stories_boomerang_v2_universe,ig_android_ads_profile_cta_feed_universe,ig_android_vc_cowatch_universe,ig_android_nametag,ig_hashtag_creation_universe,ig_android_igtv_chaining,ig_android_live_qa_viewer_v1_universe,ig_shopping_insights_wc_copy_update_android,ig_android_stories_music_lyrics_pre_capture,android_cameracore_fbaudio_integration_ig_universe,ig_android_camera_stopmotion,ig_android_igtv_reshare,ig_android_wellbeing_timeinapp_v1_universe,ig_android_profile_cta_v3,ig_end_of_feed_universe,ig_android_mainfeed_generate_prefetch_background,ig_android_vc_shareable_moments_universe,ig_camera_text_overlay_controller_opt_universe,ig_android_shopping_product_metadata_on_product_tiles_universe,ig_android_video_qp_logger_universe,ig_android_shopping_pdp_cache,ig_android_follow_request_button_improvements_universe,ig_android_vc_start_from_direct_inbox_universe,ig_android_separate_network_executor,ig_perf_android_holdout,ig_fb_graph_differentiation_only_fb_candidates,ig_android_media_streaming_sdk_universe,ig_android_direct_reshares_from_thread,ig_android_stories_video_prefetch_kb,ig_android_wellbeing_timeinapp_v1_migration,ig_android_camera_post_smile_face_first_universe,ig_android_maintabfragment,ig_android_cookie_injection_retry_universe,ig_inventory_connections,ig_stories_injection_tool_enabled_universe,ig_android_canvas_cookie_universe,ig_android_stories_disable_highlights_media_preloading,ig_android_effect_gallery_post_capture_universe,ig_android_shopping_variant_selector_redesign,ig_android_branded_content_ads_universe,ig_promote_lotus_universe,ig_android_video_streaming_upload_universe,ig_camera_android_attribution_bottomsheet_universe,ig_android_product_tag_hint_dots,ig_interactions_h1_2019_team_holdout_universe,ig_camera_android_release_drawing_view_universe,ig_android_music_story_fb_crosspost_universe,ig_android_disable_scroll_listeners,ig_carousel_bumped_organic_impression_client_universe,ig_android_ad_async_ads_universe,ig_biz_post_approval_nux_universe,ig_android_vc_participants_grid_refactor_universe,android_ard_ig_modelmanager_cache_hit,ig_android_persistent_nux,ig_android_crash_fix_detach_from_gl_context,ig_android_branded_content_upsell_keywords_extension,ig_android_vc_ringscreen_timeout_universe,ig_android_edit_location_page_info,ig_android_stories_project_eclipse,ig_camera_android_segmentation_v106_igdjango_universe,ig_android_camera_recents_gallery_modal,ig_promote_are_you_sure_universe,ig_android_li_session_chaining,ig_android_camera_platform_effect_share_universe,ig_android_rate_limit_mediafeedviewablehelper,ig_android_search_empty_state,ig_android_camera_ar_platform_logging,ig_stories_engagement_holdout_2019_h2_universe,ig_android_search_remove_null_state_sections,ig_direct_android_mentions_receiver,ig_camera_android_device_capabilities_experiment,ig_android_stories_viewer_drawable_cache_universe,ig_camera_android_qcc_constructor_opt_universe,ig_android_stories_alignment_guides_universe,ig_android_rn_ads_manager_universe,ig_android_video_visual_quality_score_based_abr,ig_explore_2018_post_chaining_account_recs_dedupe_universe,ig_android_stories_video_seeking_audio_bug_fix,ig_android_insights_holdout,ig_android_do_not_show_social_context_for_likes_page_universe,ig_android_context_feed_recycler_view,ig_fb_notification_universe,ig_android_report_website_universe,ig_android_feed_post_sticker,ig_android_inline_editing_local_prefill,ig_android_commerce_platform_bloks_universe,ig_android_stories_unregister_decor_listener_universe,ig_android_search_condensed_search_icons,ig_android_video_abr_universe,ig_android_blended_inbox_split_button_v2_universe,ig_android_nelson_v0_universe,ig_android_scroll_audio_priority,ig_android_own_profile_sharing_universe,ig_android_vc_cowatch_media_share_universe,ig_biz_graph_unify_assoc_universe,ig_challenge_general_v2,ig_android_place_signature_universe,ig_android_direct_inbox_cache_universe,ig_android_ig_branding_in_fb_universe,ig_android_business_promote_tooltip,ig_android_tap_to_capture_universe,ig_android_follow_requests_ui_improvements,ig_android_video_ssim_fix_compare_frame_index,ig_android_direct_aggregated_media_and_reshares,ig_android_story_camera_share_to_feed_universe,ig_android_fb_follow_server_linkage_universe,ig_android_stories_viewer_reply_box_placeholder_copy,ig_android_biz_reorder_value_props,ig_android_direct_view_more_qe,ig_android_churned_find_friends_redirect_to_discover_people,ig_android_main_feed_new_posts_indicator_universe,ig_vp9_hd_blacklist,ig_camera_android_ar_effect_stories_deeplink,ig_android_client_side_delivery_universe,ig_ios_queue_time_qpl_universe,ig_android_fix_direct_badge_count_universe,ig_android_insights_audience_tab_native_universe,ig_android_stories_send_client_reels_on_tray_fetch_universe,ig_android_felix_prefetch_thumbnail_sprite_sheet,ig_android_live_use_rtc_upload_universe,ig_android_multi_dex_class_loader_v2,ig_android_live_ama_viewer_universe,ig_smb_ads_holdout_2018_h2_universe,ig_android_camera_post_smile_low_end_universe,ig_android_profile_follow_tab_hashtag_row_universe,ig_android_watch_and_more_redesign,igtv_feed_previews,ig_android_live_realtime_comments_universe,ig_android_story_insights_native_universe,ig_smb_ads_holdout_2019_h2_universe,ig_android_purx_native_checkout_universe,ig_camera_android_filter_optmizations,ig_android_integrity_sprint_universe,ig_android_apr_lazy_build_request_infra,ig_android_igds_edit_profile_fields,ig_android_business_transaction_in_stories_creator,ig_android_rounded_corner_framelayout_perf_fix,ig_android_branded_content_appeal_states,android_cameracore_ard_ig_integration,ig_video_experimental_encoding_consumption_universe,ig_android_iab_autofill,ig_android_creator_quick_reply_universe,ig_android_location_page_intent_survey,ig_camera_android_segmentation_async_universe,ig_android_biz_story_to_fb_page_improvement,ig_android_direct_thread_target_queue_universe,ig_android_branded_content_insights_disclosure,ig_camera_android_target_recognition_universe,ig_camera_android_skip_camera_initialization_open_to_post_capture,ig_android_combined_tagging_videos,ig_android_stories_samsung_sharing_integration,ig_android_create_page_on_top_universe,ig_iab_use_default_intent_loading,ig_android_camera_focus_v2,ig_android_biz_conversion_pull_suggest_biz_data,ig_discovery_holdout_2019_h1_universe,ig_android_wellbeing_support_frx_comment_reporting,ig_android_insights_post_dismiss_button,ig_android_user_url_deeplink_fbpage_endpoint,ig_android_ad_holdout_watchandmore_universe,ig_android_follow_request_button_new_ui,ig_iab_dns_prefetch_universe,ig_android_explore_use_shopping_endpoint,ig_android_image_upload_skip_queue_only_on_wifi,ig_android_igtv_pip,ig_android_ad_watchbrowse_carousel_universe,ig_android_camera_new_post_smile_universe,ig_android_shopping_signup_redesign_universe,ig_android_direct_hide_inbox_header,ig_shopping_pdp_more_related_product_section,ig_android_experimental_onetap_dialogs_universe,ig_android_fix_main_feed_su_cards_size_universe,ig_android_direct_multi_upload_universe,ig_camera_text_mode_composer_controller_opt_universe,ig_explore_2019_h1_video_autoplay_resume,ig_android_multi_capture_camera,ig_android_video_upload_quality_qe1,ig_android_follow_requests_copy_improvements,ig_android_save_collaborative_collections,coupon_price_test_boost_instagram_media_acquisition_universe,ig_android_video_outputsurface_handlerthread_universe,ig_android_country_code_fix_universe,ig_perf_android_holdout_2018_h1,ig_android_stories_music_overlay,ig_android_enable_lean_crash_reporting_universe,ig_android_resumable_downloads_logging_universe,ig_android_low_latency_consumption_universe,ig_android_render_output_surface_timeout_universe,ig_android_big_foot_foregroud_reporting,ig_android_unified_iab_logging_universe,ig_threads_app_close_friends_integration,ig_aggregated_quick_reactions,ig_android_shopping_pdp_post_purchase_sharing,ig_android_aggressive_cookie,ig_android_offline_mode_holdout,ig_android_realtime_mqtt_logging,ig_android_rainbow_hashtags,ig_android_no_bg_effect_tray_live_universe,ig_android_direct_block_from_group_message_requests,ig_android_react_native_universe_kill_switch,ig_android_viewpoint_occlusion,ig_android_logged_in_delta_migration,ig_android_push_reliability_universe,ig_android_stories_gallery_video_segmentation,ig_android_direct_business_holdout,ig_android_vc_direct_inbox_ongoing_pill_universe,ig_android_xposting_upsell_directly_after_sharing_to_story,ig_android_direct_sticker_search_upgrade_universe,ig_android_insights_native_post_universe,ig_android_dual_destination_quality_improvement,ig_android_camera_focus_low_end_universe,ig_android_camera_hair_segmentation_universe,ig_android_direct_combine_action_logs,ig_android_leak_detector_upload_universe,ig_android_ads_data_preferences_universe,ig_android_branded_content_access_upsell,ig_android_follow_button_in_story_viewers_list,ig_android_vc_background_call_toast_universe,ig_hashtag_following_holdout_universe,ig_promote_default_destination_universe,ig_android_delay_segmentation_low_end_universe,ig_android_direct_media_latency_optimizations,mi_viewpoint_viewability_universe,android_ard_ig_download_manager_v2,ig_direct_reshare_sharesheet_ranking,ig_music_dash,ig_android_fb_url_universe,ig_android_le_videoautoplay_disabled,ig_android_reel_raven_video_segmented_upload_universe,ig_android_promote_native_migration_universe,invite_friends_by_messenger_in_setting_universe,ig_android_fb_sync_options_universe,ig_android_thread_gesture_refactor,ig_android_stories_skip_seen_state_update_for_direct_stories,ig_android_recommend_accounts_destination_routing_fix,ig_android_fix_prepare_direct_push,ig_android_enable_automated_instruction_text_ar,ig_android_multi_author_story_reshare_universe,ig_android_building_aymf_universe,ig_android_internal_sticker_universe,ig_traffic_routing_universe,ig_android_payments_growth_business_payments_within_payments_universe,ig_camera_async_gallerycontroller_universe,ig_android_direct_state_observer,ig_android_page_claim_deeplink_qe,ig_android_camera_effects_order_universe,ig_android_video_controls_universe,ig_android_video_local_proxy_video_metadata,ig_android_logging_metric_universe_v2,ig_android_network_onbehavior_change_fix,ig_android_xposting_newly_fbc_people,ig_android_visualcomposer_inapp_notification_universe,ig_android_do_not_show_social_context_on_follow_list_universe,ig_android_contact_point_upload_rate_limit_killswitch,ig_android_webrtc_encoder_factory_universe,ig_android_qpl_class_marker,ig_android_fix_profile_pic_from_fb_universe,ig_android_sso_kototoro_app_universe,ig_android_camera_3p_in_post,ig_android_ar_effect_sticker_consumption_universe,ig_android_direct_unread_count_badge,ig_android_profile_thumbnail_impression,ig_android_igtv_autoplay_on_prepare,ig_android_list_adapter_prefetch_infra,ig_file_based_session_handler_2_universe,ig_branded_content_tagging_upsell,ig_android_clear_inflight_image_request,ig_android_main_feed_video_countdown_timer,ig_android_live_ama_universe,ig_android_external_gallery_import_affordance,ig_search_hashtag_content_advisory_remove_snooze,ig_payment_checkout_info,ig_android_optic_new_zoom_controller,ig_android_photos_qpl,ig_stories_ads_delivery_rules,ig_android_downloadable_spark_spot,ig_android_video_upload_iframe_interval,ig_business_new_value_prop_universe,ig_android_power_metrics,ig_android_vio_pipeline_universe,ig_android_show_profile_picture_upsell_in_reel_universe,ig_discovery_holdout_universe,ig_android_direct_import_google_photos2,ig_direct_feed_media_sticker_universe,ig_android_igtv_upload_error_messages,ig_android_stories_collapse_seen_segments,ig_android_self_profile_suggest_business_main,ig_android_suggested_users_background,ig_android_fetch_xpost_setting_in_camera_fully_open,ig_android_hashtag_discover_tab,ig_android_stories_separate_overlay_creation,ig_android_ads_bottom_sheet_report_flow,ig_android_login_onetap_upsell_universe,ig_android_iris_improvements,enable_creator_account_conversion_v0_universe,ig_android_test_not_signing_address_book_unlink_endpoint,ig_android_low_disk_recovery_universe,ig_ei_option_setting_universe,ig_android_account_insights_native_universe,ig_camera_android_ar_platform_universe,ig_android_browser_ads_page_content_width_universe,ig_android_stories_viewer_prefetch_improvements,ig_android_livewith_liveswap_optimization_universe,ig_android_camera_leak,ig_android_feed_core_unified_tags_universe,ig_android_jit,ig_android_optic_camera_warmup,ig_stories_rainbow_ring,ig_android_place_search_profile_image,ig_android_vp8_audio_encoder,android_cameracore_safe_makecurrent_ig,ig_android_analytics_diagnostics_universe,ig_android_ar_effect_sticker_universe,ig_direct_android_mentions_sender,ig_android_whats_app_contact_invite_universe,ig_android_stories_reaction_setup_delay_universe,ig_shopping_visual_product_sticker,ig_android_profile_unified_follow_view,ig_android_video_upload_hevc_encoding_universe,ig_android_mentions_suggestions,ig_android_vc_face_effects_universe,ig_android_fbpage_on_profile_side_tray,ig_android_direct_empty_state,ig_android_shimmering_loading_state,ig_android_igtv_refresh_tv_guide_interval,ig_android_gallery_minimum_video_length,ig_android_notif_improvement_universe,ig_android_hashtag_remove_share_hashtag,ig_android_fb_profile_integration_fbnc_universe,ig_shopping_checkout_2x2_platformization_universe,ig_android_direct_bump_active_threads,ig_fb_graph_differentiation_control,ig_android_show_create_content_pages_universe,ig_android_igsystrace_universe,ig_android_search_register_recent_store,ig_feed_content_universe,ig_android_disk_usage_logging_universe,ig_android_search_without_typed_hashtag_autocomplete,ig_android_video_product_specific_abr,ig_android_vc_interop_latency,ig_android_stories_layout_universe,ig_android_dont_animate_shutter_button_on_open,ig_android_vc_cpu_overuse_universe,ig_android_invite_list_button_redesign_universe,ig_android_react_native_email_sms_settings_universe,ig_hero_player,ag_family_bridges_2018_h2_holdout,ig_promote_net_promoter_score_universe,ig_android_save_auto_sharing_to_fb_option_on_server,aymt_instagram_promote_flow_abandonment_ig_universe,ig_android_whitehat_options_universe,ig_android_keyword_media_serp_page,ig_android_delete_ssim_compare_img_soon,ig_android_felix_video_upload_length,android_cameracore_preview_frame_listener2_ig_universe,ig_android_direct_message_follow_button,ig_android_biz_conversion_suggest_biz_nux,ig_stories_ads_media_based_insertion,ig_android_analytics_background_uploader_schedule,ig_camera_android_boomerang_attribution_universe,ig_android_igtv_browse_long_press,ig_android_profile_neue_infra_rollout_universe,ig_android_profile_ppr_fixes,ig_discovery_2019_h2_holdout_universe,ig_android_stories_weblink_creation,ig_android_blur_image_renderer,ig_profile_company_holdout_h2_2018,ig_android_ads_manager_pause_resume_ads_universe,ig_android_vc_capture_universe,ig_nametag_local_ocr_universe,ig_android_stories_media_seen_batching_universe,ig_android_interactions_nav_to_permalink_followup_universe,ig_camera_discovery_surface_universe,ig_android_save_to_collections_flow,ig_android_direct_segmented_video,instagram_stories_time_fixes,ig_android_le_cold_start_improvements,ig_android_direct_mark_as_read_notif_action,ig_android_stories_async_view_inflation_universe,ig_android_stories_recently_captured_universe,ig_android_direct_inbox_presence_refactor_universe,ig_business_integrity_ipc_universe,ig_android_direct_selfie_stickers,ig_android_vc_missed_call_call_back_action_universe,ig_cameracore_android_new_optic_camera2,ig_fb_graph_differentiation_top_k_fb_coefficients,ig_android_fbc_upsell_on_dp_first_load,ig_android_rename_share_option_in_dialog_menu_universe,ig_android_direct_refactor_inbox_observable_universe,ig_android_business_attribute_sync,ig_camera_android_bg_processor,ig_android_view_and_likes_cta_universe,ig_android_optic_new_focus_controller,ig_android_dropframe_manager,ig_android_direct_default_group_name,ig_android_optic_new_features_implementation,ig_android_search_hashtag_badges,ig_android_stories_reel_interactive_tap_target_size,ig_android_video_live_trace_universe,ig_android_tango_cpu_overuse_universe,ig_android_igtv_browse_with_pip_v2,ig_android_direct_fix_realtime_status,ig_android_unfollow_from_main_feed_v2,ig_android_self_story_setting_option_in_menu,ig_android_story_ads_tap_and_hold_fixes,ig_android_camera_ar_platform_details_view_universe,android_ard_ig_cache_size,ig_android_story_real_time_ad,ig_android_hybrid_bitmap_v4,ig_android_iab_downloadable_strings_universe,ig_android_branded_content_ads_enable_partner_boost,ufi_share,ig_android_direct_remix_visual_messages,ig_quick_story_placement_validation_universe,ig_android_custom_story_import_intent,ig_android_live_qa_broadcaster_v1_universe,ig_android_search_impression_logging_viewpoint,ig_android_downloadable_fonts_universe,ig_android_view_info_universe,ig_android_camera_upsell_dialog,ig_android_business_transaction_in_stories_consumer,ig_android_dead_code_detection,ig_android_promotion_insights_bloks,ig_android_direct_autoplay_videos_automatically,ig_android_ad_watchbrowse_universe,ig_android_pbia_proxy_profile_universe,ig_android_qp_kill_switch,ig_android_new_follower_removal_universe,instagram_android_stories_sticker_tray_redesign,ig_android_branded_content_access_tag,ig_android_gap_rule_enforcer_universe,ig_android_business_cross_post_with_biz_id_infra,ig_android_direct_delete_or_block_from_message_requests,ig_android_photo_invites,ig_interactions_h2_2019_team_holdout_universe,ig_android_reel_tray_item_impression_logging_viewpoint,ig_account_identity_2018_h2_lockdown_phone_global_holdout,ig_android_direct_left_aligned_navigation_bar,ig_android_high_res_gif_stickers,ig_android_feed_load_more_viewpoint_universe,ig_android_stories_reshare_reply_msg,ig_close_friends_v4,ig_android_ads_history_universe,ig_android_pigeon_sampling_runnable_check,ig_promote_media_picker_universe,ig_direct_holdout_h2_2018,ig_android_sidecar_report_ssim,ig_android_pending_media_file_registry,ig_android_wab_adjust_resize_universe,ig_camera_android_facetracker_v12_universe,ig_android_camera_ar_effects_low_storage_universe,ig_android_profile_add_profile_pic_universe,ig_android_ig_to_fb_sync_universe,ig_android_ar_background_effect_universe,ig_android_audience_control,ig_android_fix_recommended_user_impression,ig_android_stories_cross_sharing_to_fb_holdout_universe,shop_home_hscroll_see_all_button_universe,ig_android_refresh_empty_feed_su_universe,ig_android_shopping_parallel_pdp_fetch,ig_android_enable_main_feed_reel_tray_preloading,ig_android_ad_view_ads_native_universe,ig_android_branded_content_tag_redesign_organic,ig_android_profile_neue_universe,ig_android_igtv_whitelisted_for_web,ig_android_viewmaster_dial_ordering_universe,ig_company_profile_holdout,ig_rti_inapp_notifications_universe,ig_android_vc_join_timeout_universe,ig_shop_directory_entrypoint,ig_android_direct_rx_thread_update,ig_android_add_ci_upsell_in_normal_account_chaining_universe,ig_android_feed_core_ads_2019_h1_holdout_universe,ig_close_friends_v4_global,ig_android_share_publish_page_universe,ig_android_new_camera_design_universe,ig_direct_max_participants,ig_promote_hide_local_awareness_universe,ar_engine_audio_service_fba_decoder_ig,ar_engine_audio_fba_integration_instagram,ig_android_igtv_save,ig_android_explore_lru_cache,ig_android_graphql_survey_new_proxy_universe,ig_android_music_browser_redesign,ig_camera_android_try_on_camera_universe,ig_android_follower_following_whatsapp_invite_universe,ig_android_fs_creation_flow_tweaks,ig_direct_blocking_redesign_universe,ig_android_viewmaster_ar_memory_improvements,ig_android_downloadable_vp8_module,ig_android_claim_location_page,ig_android_direct_inbox_recently_active_presence_dot_universe,ig_android_stories_gutter_width_universe,ig_android_story_ads_2019_h1_holdout_universe,ig_android_3pspp,ig_android_cache_timespan_objects,ig_timestamp_public_test,ig_android_fb_profile_integration_universe,ig_android_feed_auto_share_to_facebook_dialog,ig_android_skip_button_content_on_connect_fb_universe,ig_android_network_perf_qpl_ppr,ig_android_post_live,ig_camera_android_focus_attribution_universe,ig_camera_async_space_validation_for_ar,ig_android_core_search_2019_h2,ig_android_prefetch_notification_data,ig_android_stories_music_line_by_line_cube_reveal_lyrics_sticker,ig_android_iab_clickid_universe,ig_android_interactions_hide_keyboard_onscroll,ig_early_friending_holdout_universe,ig_story_camera_reverse_video_experiment,ig_android_profile_lazy_load_carousel_media,ig_android_stories_question_sticker_music_format,ig_android_vpvd_impressions_universe,ig_android_payload_based_scheduling,ig_pacing_overriding_universe,ig_android_ard_ptl_universe,ig_android_q3lc_transparency_control_settings,ig_stories_selfie_sticker,ig_android_sso_use_trustedapp_universe,ig_android_stories_music_lyrics,ig_android_spark_studio_promo,ig_android_stories_music_awareness_universe,ard_ig_broti_effect,ig_android_camera_class_preloading,ig_android_new_fb_page_selection,ig_video_holdout_h2_2017,ig_background_prefetch,ig_camera_android_focus_in_post_universe,ig_android_time_spent_dashboard,ig_android_story_sharing_universe,ig_promote_political_ads_universe,ig_android_camera_effects_initialization_universe,ig_promote_post_insights_entry_universe,ig_android_ad_iab_qpl_kill_switch_universe,ig_android_live_subscribe_user_level_universe,ig_android_igtv_creation_flow,ig_android_vc_sounds_universe,ig_android_video_call_finish_universe,ig_camera_android_cache_format_picker_children,direct_unread_reminder_qe,ig_android_direct_mqtt_send,ig_android_self_story_button_non_fbc_accounts,ig_android_self_profile_suggest_business_gating,ig_feed_video_autoplay_stop_threshold,ig_android_explore_discover_people_entry_point_universe,ig_android_live_webrtc_livewith_params,ig_feed_experience,ig_android_direct_activator_cards,ig_android_vc_codec_settings,ig_promote_prefill_destination_universe,ig_android_appstate_logger,ig_android_profile_leaks_holdouts,ig_android_video_cached_bandwidth_estimate,ig_promote_insights_video_views_universe,ig_android_global_scheduler_offscreen_prefetch,ig_android_discover_interests_universe,ig_android_camera_gallery_upload_we_universe,ig_android_business_category_sticky_header_qe,ig_android_dismiss_recent_searches,ig_android_feed_camera_size_setter,ig_payment_checkout_cvv,ig_android_fb_link_ui_polish_universe,ig_android_tags_unification_universe,ig_android_shopping_lightbox,ig_android_bandwidth_timed_estimator,ig_android_stories_mixed_attribution_universe,ig_iab_tti_holdout_universe,ig_android_ar_button_visibility,ig_android_igtv_crop_top_consumption,ig_android_camera_gyro_universe,ig_android_nametag_effect_deeplink_universe,ig_android_blurred_product_image_previews,ig_android_igtv_ssim_report,ig_android_optic_surface_texture_cleanup,ig_android_business_remove_unowned_fb_pages,ig_android_stories_combined_asset_search,ig_promote_enter_error_screens_universe,ig_stories_allow_camera_actions_while_recording,ig_android_analytics_mark_events_as_offscreen,ig_shopping_checkout_mvp_experiment,ig_android_video_fit_scale_type_igtv,ig_android_direct_pending_media,ig_android_scroll_main_feed,instagram_pcp_activity_feed_following_tab_universe,ig_android_optic_feature_testing,ig_android_igtv_player_follow_button,ig_android_intialization_chunk_410,ig_android_vc_start_call_minimized_universe,ig_android_recognition_tracking_thread_prority_universe,ig_android_stories_music_sticker_position,ig_android_optic_photo_cropping_fixes,ig_camera_regiontracking_use_similarity_tracker_for_scaling,ig_android_interactions_media_breadcrumb,ig_android_vc_cowatch_config_universe,ig_android_nametag_save_experiment_universe,ig_android_refreshable_list_view_check_spring,ig_android_biz_endpoint_switch,ig_android_direct_continuous_capture,ig_android_comments_direct_reply_to_author,ig_android_profile_visits_in_bio,ig_android_fs_new_gallery,ig_android_remove_follow_all_fb_list,ig_android_vc_webrtc_params,ig_android_specific_story_sharing,ig_android_claim_or_connect_page_on_xpost,ig_android_anr,ig_android_story_viewpoint_impression_event_universe,ig_android_image_exif_metadata_ar_effect_id_universe,ig_android_optic_new_architecture,ig_android_stories_viewer_as_modal_high_end_launch,ig_android_local_info_page,ig_new_eof_demarcator_universe";
18 | public static readonly string LOGIN_EXPERIMENTS = "ig_android_fci_onboarding_friend_search,ig_android_device_detection_info_upload,ig_android_account_linking_upsell_universe,ig_android_direct_main_tab_universe_v2,ig_android_sms_retriever_backtest_universe,ig_android_direct_add_direct_to_android_native_photo_share_sheet,ig_growth_android_profile_pic_prefill_with_fb_pic_2,ig_account_identity_logged_out_signals_global_holdout_universe,ig_android_login_identifier_fuzzy_match,ig_android_video_render_codec_low_memory_gc,ig_android_custom_transitions_universe,ig_android_push_fcm,ig_android_show_login_info_reminder_universe,ig_android_email_fuzzy_matching_universe,ig_android_one_tap_aymh_redesign_universe,ig_android_direct_send_like_from_notification,ig_android_suma_landing_page,ig_android_session_scoped_logger,ig_android_user_session_scoped_class_opt_universe,ig_android_accoun_switch_badge_fix_universe,ig_android_smartlock_hints_universe,ig_android_black_out,ig_activation_global_discretionary_sms_holdout,ig_android_account_switch_infra_universe,ig_android_video_ffmpegutil_pts_fix,ig_android_multi_tap_login_new,ig_android_caption_typeahead_fix_on_o_universe,ig_android_save_pwd_checkbox_reg_universe,ig_android_nux_add_email_device,ig_android_direct_remove_view_mode_stickiness_universe,ig_username_suggestions_on_username_taken,ig_android_ingestion_video_support_hevc_decoding,ig_android_secondary_account_creation_universe,ig_android_account_recovery_auto_login,ig_android_sim_info_upload,ig_android_mobile_http_flow_device_universe,ig_android_hide_fb_button_when_not_installed_universe,ig_android_targeted_one_tap_upsell_universe,ig_android_gmail_oauth_in_reg,ig_android_account_linking_flow_shorten_universe,ig_android_hide_typeahead_for_logged_users,ig_android_vc_interop_use_test_igid_universe,ig_android_log_suggested_users_cache_on_error,ig_android_reg_modularization_universe,ig_android_phone_edit_distance_universe,ig_android_device_verification_separate_endpoint,ig_android_universe_noticiation_channels,ig_smartlock_login,ig_android_igexecutor_sync_optimization_universe,ig_android_account_linking_skip_value_props_universe,ig_android_account_linking_universe,ig_android_hsite_prefill_new_carrier,ig_android_retry_create_account_universe,ig_android_family_apps_user_values_provider_universe,ig_android_reg_nux_headers_cleanup_universe,ig_android_device_info_foreground_reporting,ig_android_shortcuts_2019,ig_android_device_verification_fb_signup,ig_android_onetaplogin_optimization,ig_video_debug_overlay,ig_android_ask_for_permissions_on_reg,ig_assisted_login_universe,ig_android_display_full_country_name_in_reg_universe,ig_android_security_intent_switchoff,ig_android_device_info_job_based_reporting,ig_android_passwordless_auth,ig_android_direct_main_tab_account_switch,ig_android_modularized_dynamic_nux_universe,ig_android_fb_account_linking_sampling_freq_universe,ig_android_fix_sms_read_lollipop,ig_android_access_flow_prefill";
19 | public static readonly string SIG_KEY_VERSION = "4";
20 | public static readonly string BREADCRUMB_KEY = "iN4$aGr0m";
21 | public static readonly string UserAgent = buildUserAgent(IG_VERSION);
22 |
23 | // Endpoint Constants.
24 | public static readonly string BLOCK_VERSIONING_ID = "a4b4b8345a67599efe117ad96b8a9cb357bb51ac3ee00c3a48be37ce10f2bb4c"; // getTimelineFeed()
25 |
26 | // User-Agent Constants.
27 | public static readonly string USER_AGENT_LOCALE = "en_US"; //language_COUNTRY
28 |
29 | // HTTP Protocol Constants.
30 | public static readonly string ACCEPT_LANGUAGE = "en-US"; //language_COUNTRY
31 | public static readonly string ACCEPT_ENCODING = "gzip, deflate, sdch";
32 | public static readonly string CONTENT_TYPE = "application/x-www-form-urlencoded; charset=UTF-8";
33 | public static readonly string X_FB_HTTP_Engine = "Liger";
34 | public static readonly string X_IG_Connection_Type = "WIFI";
35 | public static readonly string X_IG_Capabilities = "3brTvw==";
36 |
37 | // Instagram Analytics.
38 | public static readonly string ANALYTICS_ACCESS_TOKEN = "567067343352427|f249176f09e26ce54212b472dbab8fa8";
39 | public static readonly int SURFACE_PARAM = 4715;
40 |
41 | public static string buildUserAgent(string appVersion)
42 | {
43 | return "Instagram " + appVersion + " Android (" + GoodDevices.getRandomGoodDevice() + ")";
44 | }
45 | }
46 |
47 | class Device_Settings
48 | {
49 | private static string[] split = Constants.UserAgent.Split('(');
50 | public static readonly string android_version = split[1].Split(';')[0].Split('/')[0];
51 | public static readonly string android_release = split[1].Split(';')[0].Split('/')[1];
52 | public static readonly string manufacturer = split[1].Split(';')[3];
53 | public static readonly string model = split[1].Split(';')[4];
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Globals.cs:
--------------------------------------------------------------------------------
1 | namespace InstagramPrivateAPI.src
2 | {
3 | internal class Globals
4 | {
5 | public static bool isLoggedIn;
6 | public static string csrftoken;
7 | public static string uuid;
8 | public static string LastResponse;
9 | public static string rank_token;
10 | public static string username_id;
11 | public static string token;
12 | public static string advertising_id;
13 | public static string phone_id;
14 | public static string device_id;
15 | public static string session_id;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/models/direct/DirectStory.cs:
--------------------------------------------------------------------------------
1 | using InstagramPrivateAPI.src.models.direct.item;
2 |
3 | namespace InstagramPrivateAPI.src.models.direct
4 | {
5 | internal class DirectStory
6 | {
7 | public List items { get; set; }
8 | public long last_activity_at { get; set; }
9 | public bool has_newer { get; set; }
10 | public String next_cursor { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/models/direct/IGThread.cs:
--------------------------------------------------------------------------------
1 | using InstagramPrivateAPI.src.models.direct.item;
2 | using InstagramPrivateAPI.src.models.user;
3 |
4 | namespace InstagramPrivateAPI.src.models.direct
5 | {
6 | internal class IGThread
7 | {
8 | public bool has_older { get; set; }
9 | public bool has_newer { get; set; }
10 | public bool pending { get; set; }
11 | public List items { get; set; }
12 | public bool canonical { get; set; }
13 | public string thread_id { get; set; }
14 | public string thread_v2_id { get; set; }
15 | public List users { get; set; }
16 | public long viewer_id { get; set; }
17 | public long last_activity_at { get; set; }
18 | public bool muted { get; set; }
19 | public bool vc_muted { get; set; }
20 | public string encoded_server_data_info { get; set; }
21 | public List