├── .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 admin_user_ids { get; set; } 22 | public bool approval_required_for_new_members { get; set; } 23 | public bool archived { get; set; } 24 | public bool thread_has_audio_only_call { get; set; } 25 | public List pending_user_ids { get; set; } 26 | public Object last_seen_at { get; set; } 27 | public int relevancy_score { get; set; } 28 | public int relevancy_score_expr { get; set; } 29 | public string oldest_cursor { get; set; } 30 | public string newest_cursor { get; set; } 31 | public Profile inviter { get; set; } 32 | public ThreadItem last_permanent_item { get; set; } 33 | public bool named { get; set; } 34 | public string next_cursor { get; set; } 35 | public string prev_cursor { get; set; } 36 | public string thread_title { get; set; } 37 | public List left_users { get; set; } 38 | public bool spam { get; set; } 39 | public bool bc_partnership { get; set; } 40 | public bool mentions_muted { get; set; } 41 | public string thread_type { get; set; } 42 | public bool thread_has_drop_in { get; set; } 43 | public object video_call_id { get; set; } 44 | public bool shh_mode_enabled { get; set; } 45 | public object shh_toggler_userid { get; set; } 46 | public bool shh_replay_enabled { get; set; } 47 | public bool is_group { get; set; } 48 | public int input_mode { get; set; } 49 | public int read_state { get; set; } 50 | public int assigned_admin_id { get; set; } 51 | public int folder { get; set; } 52 | public int last_non_sender_item_at { get; set; } 53 | public int business_thread_folder { get; set; } 54 | public object theme_data { get; set; } 55 | public int thread_label { get; set; } 56 | public bool marked_as_unread { get; set; } 57 | public List thread_context_items { get; set; } 58 | public bool is_close_friend_thread { get; set; } 59 | public bool has_groups_xac_ineligible_user { get; set; } 60 | public object thread_image { get; set; } 61 | public bool is_xac_thread { get; set; } 62 | public bool is_translation_enabled { get; set; } 63 | public int translation_banner_impression_count { get; set; } 64 | public int system_folder { get; set; } 65 | public bool is_fanclub_subscriber_thread { get; set; } 66 | public string joinable_group_link { get; set; } 67 | public int group_link_joinable_mode { get; set; } 68 | public object smart_suggestion { get; set; } 69 | public bool is_creator_subscriber_thread { get; set; } 70 | public object creator_subscriber_thread_response { get; set; } 71 | public string rtc_feature_set_str { get; set; } 72 | 73 | public class ThreadContextItem 74 | { 75 | public int type { get; set; } 76 | public string text { get; set; } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/models/direct/Inbox.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.direct 2 | { 3 | internal class Inbox 4 | { 5 | public List threads { get; set; } 6 | public bool has_older { get; set; } 7 | public int unseen_count { get; set; } 8 | public long unseen_count_ts { get; set; } 9 | public String oldest_cursor { get; set; } 10 | public Cursor prev_cursor { get; set; } 11 | public Cursor next_cursor { get; set; } 12 | public bool blended_inbox_enabled { get; set; } 13 | 14 | public class Cursor 15 | { 16 | public String cursor_timestamp_seconds { get; set; } 17 | public String cursor_thread_v2_id { get; set; } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/models/direct/IndoxThread.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace InstagramPrivateAPI.src.models.direct 8 | { 9 | internal class IndoxThread 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/models/direct/item/ThreadItem.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.direct.item 2 | { 3 | internal class ThreadItem 4 | { 5 | public String item_id { get; set; } 6 | public long user_id { get; set; } 7 | public long timestamp { get; set; } 8 | public String item_type { get; set; } 9 | public String client_context { get; set; } 10 | public bool show_forward_attribution { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/models/direct/item/ThreadRavenMediaItem.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.media.thread; 2 | 3 | namespace InstagramPrivateAPI.src.models.direct.item 4 | { 5 | internal class ThreadRavenMediaItem : ThreadItem 6 | { 7 | public ThreadVisualMedia visual_media { get; set; } 8 | 9 | public class ThreadVisualMedia 10 | { 11 | public long url_expire_at_secs { get; set; } 12 | public int playback_duration_secs { get; set; } 13 | public ThreadMedia media { get; set; } 14 | public List seen_user_ids { get; set; } 15 | public String view_mode { get; set; } 16 | public int seen_count { get; set; } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/models/discover/Cluster.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.discover 2 | { 3 | internal class Cluster 4 | { 5 | public String id; 6 | public String title; 7 | public String context; 8 | public String description; 9 | public List labels; 10 | public String name; 11 | public String type; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/models/discover/SectionalItem.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.discover 2 | { 3 | internal class SectionalItem 4 | { 5 | public String layout_type; 6 | public String feed_type; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/models/feed/Reel.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.media.reel; 2 | using InstagramPrivateAPI.src.models.user; 3 | 4 | namespace InstagramPrivateAPI.src.models.feed 5 | { 6 | internal class Reel 7 | { 8 | public long id { get; set; } 9 | public int latest_reel_media { get; set; } 10 | public int expiring_at { get; set; } 11 | public int seen { get; set; } 12 | public bool can_reply { get; set; } 13 | public bool can_gif_quick_reply { get; set; } 14 | public bool can_reshare { get; set; } 15 | public bool can_react_with_avatar { get; set; } 16 | public string reel_type { get; set; } 17 | public object ad_expiry_timestamp_in_millis { get; set; } 18 | public object is_cta_sticker_available { get; set; } 19 | public User user { get; set; } 20 | public List items { get; set; } 21 | public int prefetch_count { get; set; } 22 | public bool has_besties_media { get; set; } 23 | public int media_count { get; set; } 24 | public List media_ids { get; set; } 25 | public bool has_fan_club_media { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/models/friendships/FriendRequests.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.friendships 2 | { 3 | internal class FriendRequests 4 | { 5 | public int request_count { get; set; } 6 | public bool request_count_overflow { get; set; } 7 | public int profile_id { get; set; } 8 | public string profile_image { get; set; } 9 | public string sub_text { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/models/friendships/Friendship.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.friendships 2 | { 3 | internal class Friendship 4 | { 5 | public bool following { get; set; } 6 | public bool followed_by { get; set; } 7 | public bool blocking { get; set; } 8 | public bool muting { get; set; } 9 | public bool is_private { get; set; } 10 | public bool incoming_request { get; set; } 11 | public bool outgoing_request { get; set; } 12 | public bool is_blocking_reel { get; set; } 13 | public bool is_muting_reel { get; set; } 14 | public bool is_bestie { get; set; } 15 | public bool is_restricted { get; set; } 16 | public bool is_feed_favorite { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/models/live/Broadcast.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.user; 2 | 3 | namespace InstagramPrivateAPI.src.models.live 4 | { 5 | internal class Broadcast 6 | { 7 | public String id { get; set; } 8 | public String dash_playback_url { get; set; } 9 | public String dash_abr_playback_url { get; set; } 10 | public String dash_live_predictive_playback_url { get; set; } 11 | public String broadcast_status { get; set; } 12 | public int viewer_count { get; set; } 13 | public String cover_frame_url { get; set; } 14 | public User broadcast_owner { get; set; } 15 | public long published_time { get; set; } 16 | public String media_id { get; set; } 17 | public String broadcast_message { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/models/live/Info.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.user; 2 | 3 | namespace InstagramPrivateAPI.src.models.live 4 | { 5 | internal class Info 6 | { 7 | public long id { get; set; } 8 | public string dash_playback_url { get; set; } 9 | public string dash_abr_playback_url { get; set; } 10 | public string broadcast_status { get; set; } 11 | public double viewer_count { get; set; } 12 | public bool internal_only { get; set; } 13 | public List cobroadcasters { get; set; } 14 | public int is_player_live_trace_enabled { get; set; } 15 | public bool is_gaming_content { get; set; } 16 | public bool is_live_comment_mention_enabled { get; set; } 17 | public bool is_live_comment_replies_enabled { get; set; } 18 | public bool is_viewer_comment_allowed { get; set; } 19 | public Profile broadcast_owner { get; set; } 20 | public int published_time { get; set; } 21 | public bool hide_from_feed_unit { get; set; } 22 | public double video_duration { get; set; } 23 | public string media_id { get; set; } 24 | public long live_post_id { get; set; } 25 | public string broadcast_message { get; set; } 26 | public string organic_tracking_token { get; set; } 27 | public Dimensions dimensions { get; set; } 28 | public int visibility { get; set; } 29 | public int response_timestamp { get; set; } 30 | public class Dimensions 31 | { 32 | public int height { get; set; } 33 | public int width { get; set; } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/models/location/Location.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.location 2 | { 3 | internal class Location 4 | { 5 | public object pk { get; set; } 6 | public string short_name { get; set; } 7 | public long external_id { get; set; } 8 | public object facebook_places_id { get; set; } 9 | public string external_source { get; set; } 10 | public string name { get; set; } 11 | public string address { get; set; } 12 | public string city { get; set; } 13 | public bool has_viewer_saved { get; set; } 14 | public double lng { get; set; } 15 | public double lat { get; set; } 16 | public bool is_eligible_for_guides { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/models/media/CarouselMedia.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.media.video; 2 | 3 | namespace InstagramPrivateAPI.src.models.media 4 | { 5 | internal class CarouselMedia 6 | { 7 | public string id { get; set; } 8 | public int media_type { get; set; } 9 | public ImageVersions2 image_versions2 { get; set; } 10 | public int original_width { get; set; } 11 | public int original_height { get; set; } 12 | public List video_versions { get; set; } 13 | public double video_duration { get; set; } 14 | public int is_dash_eligible { get; set; } 15 | public string video_dash_manifest { get; set; } 16 | public string video_codec { get; set; } 17 | public int number_of_qualities { get; set; } 18 | public object pk { get; set; } 19 | public string carousel_parent_id { get; set; } 20 | public string commerciality_status { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/models/media/ImageVersions2.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.media 2 | { 3 | internal class ImageVersions2 4 | { 5 | public List candidates { get; set; } 6 | } 7 | public class Candidate 8 | { 9 | public int width { get; set; } 10 | public int height { get; set; } 11 | public string url { get; set; } 12 | public string scans_profile { get; set; } 13 | public List estimated_scans_sizes { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/models/media/Media.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.media.video; 2 | using InstagramPrivateAPI.src.models.user; 3 | 4 | namespace InstagramPrivateAPI.src.models.media 5 | { 6 | internal class Media 7 | { 8 | public int taken_at { get; set; } 9 | public object pk { get; set; } 10 | public string id { get; set; } 11 | public object device_timestamp { get; set; } 12 | public int media_type { get; set; } 13 | public string code { get; set; } 14 | public string client_cache_key { get; set; } 15 | public int filter_type { get; set; } 16 | public bool is_unified_video { get; set; } 17 | public bool should_request_ads { get; set; } 18 | public User user { get; set; } 19 | public bool can_viewer_reshare { get; set; } 20 | public bool caption_is_edited { get; set; } 21 | public bool like_and_view_counts_disabled { get; set; } 22 | public string commerciality_status { get; set; } 23 | public bool is_paid_partnership { get; set; } 24 | public bool is_visual_reply_commenter_notice_enabled { get; set; } 25 | public bool comment_likes_enabled { get; set; } 26 | public bool comment_threading_enabled { get; set; } 27 | public bool has_more_comments { get; set; } 28 | public int max_num_visible_preview_comments { get; set; } 29 | public bool can_view_more_preview_comments { get; set; } 30 | public int comment_count { get; set; } 31 | public bool hide_view_all_comment_entrypoint { get; set; } 32 | public string inline_composer_display_condition { get; set; } 33 | public int inline_composer_imp_trigger_time { get; set; } 34 | public string title { get; set; } 35 | public string product_type { get; set; } 36 | public bool nearly_complete_copyright_match { get; set; } 37 | public Thumbnails thumbnails { get; set; } 38 | public bool igtv_exists_in_viewer_series { get; set; } 39 | public bool is_post_live { get; set; } 40 | public ImageVersions2 image_versions2 { get; set; } 41 | public int original_width { get; set; } 42 | public int original_height { get; set; } 43 | public int like_count { get; set; } 44 | public bool has_liked { get; set; } 45 | public List top_likers { get; set; } 46 | public List likers { get; set; } 47 | public bool photo_of_you { get; set; } 48 | public bool is_organic_product_tagging_eligible { get; set; } 49 | public bool can_see_insights_as_brand { get; set; } 50 | public int is_dash_eligible { get; set; } 51 | public string video_dash_manifest { get; set; } 52 | public string video_codec { get; set; } 53 | public int number_of_qualities { get; set; } 54 | public List video_versions { get; set; } 55 | public bool has_audio { get; set; } 56 | public double video_duration { get; set; } 57 | public object caption { get; set; } 58 | public bool can_viewer_save { get; set; } 59 | public string organic_tracking_token { get; set; } 60 | public int has_shared_to_fb { get; set; } 61 | public bool is_in_profile_grid { get; set; } 62 | public bool profile_grid_control_enabled { get; set; } 63 | public bool video_subtitles_enabled { get; set; } 64 | public int deleted_reason { get; set; } 65 | public string integrity_review_decision { get; set; } 66 | public int? carousel_media_count { get; set; } 67 | public List carousel_media { get; set; } 68 | 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/models/media/Thumbnails.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.media 2 | { 3 | internal class Thumbnails 4 | { 5 | public double video_length { get; set; } 6 | public int thumbnail_width { get; set; } 7 | public int thumbnail_height { get; set; } 8 | public double thumbnail_duration { get; set; } 9 | public List sprite_urls { get; set; } 10 | public int thumbnails_per_row { get; set; } 11 | public int total_thumbnail_num_per_sprite { get; set; } 12 | public int max_thumbnails_per_sprite { get; set; } 13 | public int sprite_width { get; set; } 14 | public int sprite_height { get; set; } 15 | public int rendered_width { get; set; } 16 | public int file_size_kb { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/models/media/UserTags.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.user; 2 | 3 | namespace InstagramPrivateAPI.src.models.media 4 | { 5 | internal class UserTags 6 | { 7 | public class UserTag 8 | { 9 | public Profile user; 10 | public double[] position; 11 | public long start_time_in_video_sec; 12 | public long duration_in_video_in_sec; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/models/media/Viewer.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.media 2 | { 3 | internal class Viewer 4 | { 5 | public long pk; 6 | public String username; 7 | public String full_name; 8 | public bool is_private; 9 | public String profile_pic_url; 10 | public String profile_pic_id; 11 | public bool is_verified; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/models/media/reel/BlockedReels.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.user; 2 | 3 | namespace InstagramPrivateAPI.src.models.media.reel 4 | { 5 | internal class BlockedReels 6 | { 7 | public object sections { get; set; } 8 | public object global_blacklist_sample { get; set; } 9 | public List users { get; set; } 10 | public bool big_list { get; set; } 11 | public object next_max_id { get; set; } 12 | public int page_size { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/models/media/reel/ReelMedia.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.media.reel 2 | { 3 | internal class ReelMedia : Media 4 | { 5 | public int viewer_count; 6 | public int total_viewer_count; 7 | public List viewers; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/models/media/thread/ThreadMedia.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.media.thread 2 | { 3 | internal class ThreadMedia 4 | { 5 | public long pk { get; set; } 6 | public String id { get; set; } 7 | public String media_type { get; set; } 8 | public int original_width { get; set; } 9 | public int original_height { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/models/media/timeline/Comment.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.user; 2 | 3 | namespace InstagramPrivateAPI.src.models.media.timeline 4 | { 5 | internal class Comment 6 | { 7 | public string content_type { get; set; } 8 | public User user { get; set; } 9 | public long pk { get; set; } 10 | public string text { get; set; } 11 | public int type { get; set; } 12 | public int created_at { get; set; } 13 | public int created_at_utc { get; set; } 14 | public long media_id { get; set; } 15 | public string status { get; set; } 16 | public bool share_enabled { get; set; } 17 | 18 | public class Caption : Comment 19 | { 20 | 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/models/media/timeline/TimelineMedia.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.location; 2 | using InstagramPrivateAPI.src.models.media.timeline; 3 | using InstagramPrivateAPI.src.models.user; 4 | using Newtonsoft.Json; 5 | using static InstagramPrivateAPI.src.models.media.timeline.Comment; 6 | 7 | namespace InstagrampublicAPI.src.models.media.timeline 8 | { 9 | internal class TimelineMedia 10 | { 11 | public int type { get; set; } 12 | public string landing_site_type { get; set; } 13 | public string title { get; set; } 14 | public string view_all_text { get; set; } 15 | public string landing_site_title { get; set; } 16 | public string netego_type { get; set; } 17 | public bool is_unit_dismissable { get; set; } 18 | public string ranking_algorithm { get; set; } 19 | public string multiple_profile_navigation { get; set; } 20 | public string upsell_fb_pos { get; set; } 21 | public string auto_dvance { get; set; } 22 | public string cards_size { get; set; } 23 | public string id { get; set; } 24 | public string tracking_token { get; set; } 25 | public object global_position { get; set; } 26 | public int? taken_at { get; set; } 27 | public long? pk { get; set; } 28 | public long? device_timestamp { get; set; } 29 | public int? media_type { get; set; } 30 | public string code { get; set; } 31 | public string client_cache_key { get; set; } 32 | public int? filter_type { get; set; } 33 | public int? carousel_media_count { get; set; } 34 | public bool? can_see_insights_as_brand { get; set; } 35 | public bool? is_unified_video { get; set; } 36 | public bool? should_request_ads { get; set; } 37 | public Profile user { get; set; } 38 | public bool? can_viewer_reshare { get; set; } 39 | public bool? caption_is_edited { get; set; } 40 | public bool? like_and_view_counts_disabled { get; set; } 41 | public string commerciality_status { get; set; } 42 | public bool? is_paid_partnership { get; set; } 43 | public bool? is_visual_reply_commenter_notice_enabled { get; set; } 44 | public bool? comment_likes_enabled { get; set; } 45 | public bool? comment_threading_enabled { get; set; } 46 | public bool? has_more_comments { get; set; } 47 | public long? next_max_id { get; set; } 48 | public int? max_num_visible_preview_comments { get; set; } 49 | public List preview_comments { get; set; } 50 | public bool? can_view_more_preview_comments { get; set; } 51 | public int? comment_count { get; set; } 52 | public bool? hide_view_all_comment_entrypoint { get; set; } 53 | public string inline_composer_display_condition { get; set; } 54 | public int? inline_composer_imp_trigger_time { get; set; } 55 | public int? like_count { get; set; } 56 | public bool? has_liked { get; set; } 57 | public List top_likers { get; set; } 58 | public bool? photo_of_you { get; set; } 59 | public bool? is_organic_product_tagging_eligible { get; set; } 60 | public Caption caption { get; set; } 61 | public bool? can_viewer_save { get; set; } 62 | public string organic_tracking_token { get; set; } 63 | public int? has_shared_to_fb { get; set; } 64 | public string product_type { get; set; } 65 | public bool? is_in_profile_grid { get; set; } 66 | public bool? profile_grid_control_enabled { get; set; } 67 | public int? deleted_reason { get; set; } 68 | public string integrity_review_decision { get; set; } 69 | public object music_metadata { get; set; } 70 | public string main_feed_carousel_starting_media_id { get; set; } 71 | public bool? main_feed_carousel_has_unseen_cover_media { get; set; } 72 | public string inventory_source { get; set; } 73 | public bool? is_seen { get; set; } 74 | public bool? is_eof { get; set; } 75 | public double? ranking_weight { get; set; } 76 | public Location location { get; set; } 77 | public double? lat { get; set; } 78 | public double? lng { get; set; } 79 | 80 | public override string ToString() 81 | { 82 | return JsonConvert.SerializeObject(this); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/models/media/video/VideoVersion.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.media.video 2 | { 3 | internal class VideoVersion 4 | { 5 | public int type { get; set; } 6 | public int width { get; set; } 7 | public int height { get; set; } 8 | public string url { get; set; } 9 | public string id { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/models/news/NewsStory.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.news 2 | { 3 | internal class NewsStory 4 | { 5 | public int type { get; set; } 6 | public int story_type { get; set; } 7 | public String pk { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/models/tags/Info.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.tags 2 | { 3 | internal class Info 4 | { 5 | public long id { get; set; } 6 | public string name { get; set; } 7 | public int media_count { get; set; } 8 | public int follow_status { get; set; } 9 | public int following { get; set; } 10 | public int allow_following { get; set; } 11 | public bool allow_muting_story { get; set; } 12 | public object profile_pic_url { get; set; } 13 | public int non_violating { get; set; } 14 | public object related_tags { get; set; } 15 | public string subtitle { get; set; } 16 | public string social_context { get; set; } 17 | public List social_context_profile_links { get; set; } 18 | public List social_context_facepile_users { get; set; } 19 | public object follow_button_text { get; set; } 20 | public bool show_follow_drop_down { get; set; } 21 | public string formatted_media_count { get; set; } 22 | public object challenge_id { get; set; } 23 | public object destination_info { get; set; } 24 | public object description { get; set; } 25 | public object debug_info { get; set; } 26 | public object fresh_topic_metadata { get; set; } 27 | public object promo_banner { get; set; } 28 | public string status { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/models/tags/Tag.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.tags 2 | { 3 | internal class Tag 4 | { 5 | public object id { get; set; } 6 | public string name { get; set; } 7 | public int media_count { get; set; } 8 | public object follow_status { get; set; } 9 | public object following { get; set; } 10 | public object allow_following { get; set; } 11 | public object allow_muting_story { get; set; } 12 | public string profile_pic_url { get; set; } 13 | public object non_violating { get; set; } 14 | public object related_tags { get; set; } 15 | public object subtitle { get; set; } 16 | public object social_context { get; set; } 17 | public object social_context_profile_links { get; set; } 18 | public object social_context_facepile_users { get; set; } 19 | public object follow_button_text { get; set; } 20 | public object show_follow_drop_down { get; set; } 21 | public string formatted_media_count { get; set; } 22 | public object challenge_id { get; set; } 23 | public object destination_info { get; set; } 24 | public object description { get; set; } 25 | public object debug_info { get; set; } 26 | public object fresh_topic_metadata { get; set; } 27 | public object promo_banner { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/models/user/Besties.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.user 2 | { 3 | internal class Besties 4 | { 5 | public object sections { get; set; } 6 | public object global_blacklist_sample { get; set; } 7 | public List users { get; set; } 8 | public bool big_list { get; set; } 9 | public object next_max_id { get; set; } 10 | public int page_size { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/models/user/Profile.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.models.user 2 | { 3 | internal class Profile 4 | { 5 | public long pk { get; set; } 6 | public String username { get; set; } 7 | public String full_name { get; set; } 8 | public bool is_private { get; set; } 9 | public String profile_pic_url { get; set; } 10 | public String profile_pic_id { get; set; } 11 | public bool is_verified { get; set; } 12 | public bool has_anonymous_profile_picture { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/models/user/User.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace InstagramPrivateAPI.src.models.user 4 | { 5 | internal class User : Profile 6 | { 7 | public bool is_business { get; set; } 8 | public int media_count { get; set; } 9 | public int follower_count { get; set; } 10 | public int following_count { get; set; } 11 | public String biography { get; set; } 12 | public String external_url { get; set; } 13 | public List hd_profile_pic_versions { get; set; } 14 | public ProfilePic hd_profile_pic_url_info { get; set; } 15 | public int account_type { get; set; } 16 | 17 | public override string ToString() 18 | { 19 | return JsonConvert.SerializeObject(this); 20 | } 21 | 22 | public class ProfilePic 23 | { 24 | public String url { get; set; } 25 | public int width { get; set; } 26 | public int height { get; set; } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/requests/Account.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.responses; 2 | using InstagramPrivateAPI.src.responses.accounts; 3 | using InstagramPrivateAPI.src.responses.users; 4 | using Newtonsoft.Json.Linq; 5 | 6 | namespace InstagramPrivateAPI.src.requests 7 | { 8 | internal class Account 9 | { 10 | public void ChangeProfilePicture() 11 | { 12 | //TODO 13 | } 14 | 15 | public UserResponse RemoveProfilePicture() 16 | { 17 | dynamic data = new JObject(); 18 | data._uuid = Globals.uuid; 19 | data._uid = Globals.username_id; 20 | data._csrftoken = Globals.token; 21 | 22 | return Request.Send("accounts/remove_profile_picture/", data.ToString()); 23 | } 24 | 25 | public UserResponse SetPrivate() 26 | { 27 | dynamic data = new JObject(); 28 | data._uuid = Globals.uuid; 29 | data._uid = Globals.username_id; 30 | data._csrftoken = Globals.token; 31 | 32 | return Request.Send("accounts/set_private/", data.ToString()); 33 | } 34 | 35 | public UserResponse SetPublic() 36 | { 37 | dynamic data = new JObject(); 38 | data._uuid = Globals.uuid; 39 | data._uid = Globals.username_id; 40 | data._csrftoken = Globals.token; 41 | 42 | return Request.Send("accounts/set_public/", data.ToString()); 43 | } 44 | 45 | public Response ChangePassword(string oldPassword, string newPassword) 46 | { 47 | dynamic data = new JObject(); 48 | data._uuid = Globals.uuid; 49 | data._uid = Globals.username_id; 50 | data._csrftoken = Globals.token; 51 | data.old_password = oldPassword; 52 | data.new_password1 = newPassword; 53 | data.new_password2 = newPassword; 54 | 55 | return Request.Send("accounts/change_password/", data.ToString()); 56 | } 57 | 58 | //public string getCurrentUser() 59 | //{ 60 | // dynamic data = new JObject(); 61 | // data.edit = true; 62 | // data._uuid = Globals.uuid; 63 | // data._uid = Globals.username_id; 64 | // data._csrftoken = Globals.csrftoken; 65 | 66 | // Request.Send("accounts/current_user/", data.ToString()); 67 | // return Globals.LastResponse; 68 | //} 69 | 70 | public CheckUsernameResponse checkUsername(string username) 71 | { 72 | dynamic data = new JObject(); 73 | data._uuid = Globals.uuid; 74 | data.username = username; 75 | data._csrftoken = Globals.csrftoken; 76 | data._uid = Globals.username_id; 77 | 78 | return Request.Send("users/check_username/", data.ToString()); 79 | } 80 | 81 | public Response enablePresence() 82 | { 83 | dynamic data = new JObject(); 84 | data._uuid = Globals.uuid; 85 | data._uid = Globals.username_id; 86 | data.disabled = "0"; 87 | data._csrftoken = Globals.csrftoken; 88 | 89 | return Request.Send("accounts/set_presence_disabled/", data.ToString()); 90 | } 91 | 92 | public Response disablePresence() 93 | { 94 | dynamic data = new JObject(); 95 | data._uuid = Globals.uuid; 96 | data._uid = Globals.username_id; 97 | data.disabled = "1"; 98 | data._csrftoken = Globals.csrftoken; 99 | 100 | return Request.Send("accounts/set_presence_disabled/", data.ToString()); 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/requests/Direct.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.responses; 2 | using InstagramPrivateAPI.src.responses.direct; 3 | using Newtonsoft.Json; 4 | using Newtonsoft.Json.Linq; 5 | 6 | namespace InstagramPrivateAPI.src.requests 7 | { 8 | internal class Direct 9 | { 10 | public DirectInboxResponse getInbox(string cursorId = null) 11 | { 12 | dynamic data = new JObject(); 13 | data.persistentBadging = "true"; 14 | data.use_unified_inbox = "true"; 15 | 16 | return Request.Send("direct_v2/inbox/", data.ToString()); 17 | } 18 | 19 | public DirectInboxResponse getPendingInbox() 20 | { 21 | dynamic data = new JObject(); 22 | data.persistentBadging = "true"; 23 | data.use_unified_inbox = "true"; 24 | 25 | return Request.Send("direct_v2/pending_inbox/", data.ToString()); 26 | } 27 | 28 | public ThreadResponse getThread(string threadId, string cursorId = null) 29 | { 30 | dynamic data = new JObject(); 31 | data.use_unified_inbox = "true"; 32 | 33 | return Request.Send($"direct_v2/threads/{threadId}/", data.ToString()); 34 | } 35 | 36 | public DirectGetPresenceResponse getPresences() => Request.Send("direct_v2/get_presence/"); 37 | 38 | public Response SendDirectText(string recipients, string threadIds, string text) 39 | { 40 | var fields = new Dictionary { { "text", text } }; 41 | if (!string.IsNullOrEmpty(recipients)) 42 | fields.Add("recipient_users", "[[" + recipients + "]]"); 43 | else 44 | fields.Add("recipient_users", "[]"); 45 | 46 | if (!string.IsNullOrEmpty(threadIds)) 47 | fields.Add("thread_ids", "[" + threadIds + "]"); 48 | 49 | var o = JsonConvert.SerializeObject(fields); 50 | 51 | return Request.Send("direct_v2/threads/broadcast/text/", o); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/requests/Discover.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.responses.discover; 2 | using InstagramPrivateAPI.src.utils; 3 | using Newtonsoft.Json.Linq; 4 | 5 | namespace InstagramPrivateAPI.src.requests 6 | { 7 | internal class Discover 8 | { 9 | public DiscoverTopicalExploreResponse getExploreFeed(string maxId = null, bool isPrefetch = false) 10 | { 11 | dynamic data = new JObject(); 12 | data.is_prefetch = isPrefetch; 13 | data.is_from_promote = false; 14 | data.timezone_offset = DateTimeOffset.Now.Offset.TotalSeconds; 15 | data.session_id = Signatures.generateUUID(true); 16 | 17 | return Request.Send("discover/topical_explore/"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/requests/Hashtag.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.responses; 2 | using InstagramPrivateAPI.src.responses.feed; 3 | using InstagramPrivateAPI.src.responses.tags; 4 | using InstagramPrivateAPI.src.responses.users; 5 | using Newtonsoft.Json.Linq; 6 | 7 | namespace InstagramPrivateAPI.src.requests 8 | { 9 | internal class Hashtag 10 | { 11 | public TagsInfoResponse getInfo(string hashtag) 12 | { 13 | string urlhashtag = System.Net.WebUtility.HtmlDecode(hashtag);//for non-English chars 14 | 15 | return Request.Send($"tags/{urlhashtag}/info/"); 16 | } 17 | 18 | public FeedTagResponse getFeed(string hashtag, string maxId = null) 19 | { 20 | maxId = maxId != null ? maxId : ""; 21 | string urlhashtag = System.Net.WebUtility.HtmlDecode(hashtag);//for non-English chars 22 | 23 | return Request.Send($"feed/tag/{urlhashtag}?max_id=" + maxId); 24 | } 25 | 26 | public TagsSearchResponse search(string query) 27 | { 28 | dynamic data = new JObject(); 29 | data.q = query; 30 | data.timezone_offset = DateTimeOffset.Now.Offset.TotalSeconds; 31 | data.count = "30"; 32 | data.rank_token = Globals.rank_token; 33 | 34 | return Request.Send("tags/search/", data.ToString()); 35 | } 36 | 37 | public Response follow(string hashtag) 38 | { 39 | string urlhashtag = System.Net.WebUtility.HtmlDecode(hashtag); //for non-English chars 40 | dynamic data = new JObject(); 41 | data._uuid = Globals.uuid; 42 | data._uid = Globals.username_id; 43 | data._csrftoken = Globals.csrftoken; 44 | 45 | return Request.Send($"tags/follow/{urlhashtag}/", data.ToString()); 46 | } 47 | 48 | public Response unfollow(string hashtag) 49 | { 50 | string urlhashtag = System.Net.WebUtility.HtmlDecode(hashtag); //for non-English chars 51 | dynamic data = new JObject(); 52 | data._uuid = Globals.uuid; 53 | data._uid = Globals.username_id; 54 | data._csrftoken = Globals.csrftoken; 55 | 56 | return Request.Send($"tags/unfollow/{urlhashtag}/", data.ToString()); 57 | } 58 | 59 | public UserFollowingTagsResponse getFollowing(string userId) => Request.Send("users/" + userId + "/following_tags_info/"); 60 | 61 | public UserFollowingTagsResponse getSelfFollowing() => getFollowing(Globals.username_id); 62 | 63 | public TagsSuggestedResponse getFollowSuggestions() => Request.Send("tags/suggested/"); 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/requests/Internal.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.responses; 2 | using Newtonsoft.Json.Linq; 3 | 4 | namespace InstagramPrivateAPI.src.requests 5 | { 6 | internal class Internal 7 | { 8 | public static Response markStoryMediaSeen(string itemSourceId, string itemId, string itemTakenAt) 9 | { 10 | Int32 maxSeenAt = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; 11 | int seenAt = maxSeenAt - 3; 12 | 13 | string reelId = itemId + "_" + itemSourceId; 14 | 15 | JObject data = new JObject( 16 | new JProperty("_uuid", Globals.uuid), 17 | new JProperty("_uid", Globals.username_id), 18 | new JProperty("_csrftoken", Globals.csrftoken), 19 | new JProperty("live_vods", new JArray()), 20 | new JProperty("reels", new JObject(new JProperty(reelId, new JArray(itemTakenAt + "_" + seenAt)))), 21 | new JProperty("reel", 1), 22 | new JProperty("live_vod", 0) 23 | ); 24 | 25 | return Request.Send("media/seen/", data.ToString(), true, 1); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/requests/Live.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.responses; 2 | using InstagramPrivateAPI.src.responses.live; 3 | using InstagramPrivateAPI.src.utils; 4 | using Newtonsoft.Json.Linq; 5 | using static InstagramPrivateAPI.src.responses.live.LiveBroadcastLikeResponse; 6 | 7 | namespace InstagramPrivateAPI.src.requests 8 | { 9 | internal class Live 10 | { 11 | public LiveInfoResponse getInfo(string broadcastId) => Request.Send("live/" + broadcastId + "/info/"); 12 | 13 | public LiveBroadcastGetViewerListResponse getViewerList(string broadcastId) => Request.Send("live/" + broadcastId + "/get_viewer_list/"); 14 | 15 | public LiveBroadcastGetViewerListResponse getFinalViewerList(string broadcastId) => Request.Send("live/" + broadcastId + "/get_final_viewer_list/"); 16 | 17 | public LiveBroadcastHeartbeatResponse getHeartbeatAndViewerCount(string broadcastId) 18 | { 19 | dynamic data = new JObject(); 20 | data._uuid = Globals.uuid; 21 | data._csrftoken = Globals.csrftoken; 22 | 23 | return Request.Send("live/" + broadcastId + "/heartbeat_and_get_viewer_count/", data.ToString()); 24 | } 25 | 26 | public Response showQuestion(string broadcastId, string questionId) 27 | { 28 | dynamic data = new JObject(); 29 | data._uuid = Globals.uuid; 30 | data._csrftoken = Globals.csrftoken; 31 | 32 | return Request.Send("live/" + broadcastId + "/question/" + questionId + "/activate"); 33 | } 34 | 35 | public Response hideQuestion(string broadcastId, string questionId) 36 | { 37 | dynamic data = new JObject(); 38 | data._uuid = Globals.uuid; 39 | data._csrftoken = Globals.csrftoken; 40 | 41 | return Request.Send("live/" + broadcastId + "/question/" + questionId + "/deactivate", data.ToString()); 42 | } 43 | 44 | public Response getQuestions() => Request.Send("live/get_questions"); 45 | 46 | public Response getLiveBroadcastQuestions(string broadcastId) => Request.Send("live/" + broadcastId + "/questions/?sources=story_and_live"); 47 | 48 | public Response pinComment(string broadcastId, string commentId) 49 | { 50 | dynamic data = new JObject(); 51 | data.offset_to_video_start = 0; 52 | data.comment_id = commentId; 53 | data._uuid = Globals.uuid; 54 | data._uid = Globals.username_id; 55 | data._csrftoken = Globals.csrftoken; 56 | 57 | return Request.Send("live/" + broadcastId + "/pin_comment/", data.ToString()); 58 | } 59 | 60 | public Response unpinComment(string broadcastId, string commentId) 61 | { 62 | dynamic data = new JObject(); 63 | data.offset_to_video_start = 0; 64 | data.comment_id = commentId; 65 | data._uuid = Globals.uuid; 66 | data._uid = Globals.username_id; 67 | data._csrftoken = Globals.csrftoken; 68 | 69 | return Request.Send("live/" + broadcastId + "/unpin_comment/", data.ToString()); 70 | } 71 | 72 | public LiveBroadcastGetCommentResponse getComments(string broadcastId, string lastCommentTs = "0", string commentsRequested = "3") 73 | { 74 | dynamic data = new JObject(); 75 | data.last_comment_ts = lastCommentTs; 76 | data.num_comments_requested = commentsRequested; 77 | 78 | return Request.Send("live/" + broadcastId + "/get_comment/"); 79 | } 80 | 81 | public string enableComments(string broadcastId) 82 | { 83 | dynamic data = new JObject(); 84 | data._uid = Globals.username_id; 85 | data._uuid = Globals.uuid; 86 | data._csrftoken = Globals.csrftoken; 87 | Request.Send("live/" + broadcastId + "unmute_comment/", data.ToString()); 88 | return Globals.LastResponse; 89 | } 90 | 91 | public string disableComments(string broadcastId) 92 | { 93 | dynamic data = new JObject(); 94 | data._uid = Globals.username_id; 95 | data._uuid = Globals.uuid; 96 | data._csrftoken = Globals.csrftoken; 97 | Request.Send("live/" + broadcastId + "/mute_comment/", data.ToString()); 98 | return Globals.LastResponse; 99 | } 100 | 101 | public LiveCreateResponse create(string previewWidth = "720", string previewHeight = "1184", string broadcastMessage = "") 102 | { 103 | dynamic data = new JObject(); 104 | data._uuid = Globals.uuid; 105 | data._csrftoken = Globals.csrftoken; 106 | data.preview_height = previewHeight; 107 | data.preview_width = previewWidth; 108 | data.broadcast_message = broadcastMessage; 109 | data.broadcast_type = "RTMP"; 110 | data.internal_only = "0"; 111 | 112 | return Request.Send("live/create/", data.ToString()); 113 | } 114 | 115 | public LiveStartResponse start(string broadcastId, bool sendNotifications = true) 116 | { 117 | dynamic data = new JObject(); 118 | data._uuid = Globals.uuid; 119 | data._csrftoken = Globals.csrftoken; 120 | data.should_send_notifications = Convert.ToInt32(sendNotifications); 121 | 122 | return Request.Send($"live/{broadcastId}/start/", data.ToString()); 123 | } 124 | 125 | public Response end(string broadcastId) 126 | { 127 | dynamic data = new JObject(); 128 | data._uuid = Globals.uuid; 129 | data._csrftoken = Globals.csrftoken; 130 | 131 | return Request.Send("live/" + broadcastId + "/end_broadcast/", data.ToString()); 132 | } 133 | 134 | public LiveBroadcastLikeResponse like(string broadcastId, string likeCount = "1") 135 | { 136 | dynamic data = new JObject(); 137 | data._uuid = Globals.uuid; 138 | data._uid = Globals.username_id; 139 | data._csrftoken = Globals.csrftoken; 140 | data.user_like_count = likeCount; 141 | 142 | return Request.Send($"live/{broadcastId}/like/", data.ToString()); 143 | } 144 | 145 | public LiveJoinRequestsResponse getJoinRequests(string broadcastId) => Request.Send($"live/{broadcastId}/get_join_requests/"); 146 | public LiveQuastionStatusResponse quastionStatus(string broadcastId, bool status) 147 | { 148 | dynamic data = new JObject(); 149 | data._uuid = Globals.uuid; 150 | data._uid = Globals.username_id; 151 | data._csrftoken = Globals.csrftoken; 152 | data.allow_question_submission = status; 153 | 154 | return Request.Send($"live/{broadcastId}/question_status/", data.ToString()); 155 | } 156 | 157 | public LiveBroadcastGetLikeCountResponse getLikeCount(string broadcastId) => Request.Send($"live/{broadcastId}/get_like_count/"); 158 | 159 | public LiveBroadcastCommentResponse comment(string broadcastId, string message) 160 | { 161 | dynamic data = new JObject(); 162 | data.idempotence_token = Signatures.generateUUID(false); 163 | data.comment_text = message; 164 | 165 | return Request.Send($"live/{broadcastId}/comment/", data.ToString()); 166 | } 167 | 168 | public LiveBroadcastThumbnailsResponse GetPostLiveThumbnails(string broadcastId) => Request.Send($"live/{broadcastId}/get_post_live_thumbnails/"); 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /src/requests/Location.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.feed; 2 | using InstagramPrivateAPI.src.responses.feed; 3 | using InstagramPrivateAPI.src.responses.location; 4 | using System.Globalization; 5 | 6 | namespace InstagramPrivateAPI.src.requests 7 | { 8 | internal class Location 9 | { 10 | public LocationSearchResponse search(double latitude, double longitude, string query = null) 11 | { 12 | string data = $"?latitude={latitude.ToString(CultureInfo.InvariantCulture)}&longitude={longitude.ToString(CultureInfo.InvariantCulture)}&rank_token={Globals.rank_token}×tamp={(int)(DateTime.Now - new DateTime(1970, 1, 1).ToLocalTime()).TotalSeconds}"; 13 | 14 | return Request.Send("location_search/" + data); 15 | } 16 | 17 | public LocationInfoResponse info(string location_id) => Request.Send("locations/" + location_id + "/location_info"); 18 | 19 | public FeedLocationResponse getFeed(string location_id) => Request.Send("feed/location/" + location_id); 20 | 21 | public Reel getStoryFeed(string location_id) => getFeed(location_id).story; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/requests/Map.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.responses; 2 | using Newtonsoft.Json.Linq; 3 | using System.Globalization; 4 | 5 | namespace InstagramPrivateAPI.src.requests 6 | { 7 | internal class Map 8 | { 9 | public Response search(double latitude, double longitude) 10 | { 11 | string data = $"?map_center_lat={latitude.ToString(CultureInfo.InvariantCulture)}&map_center_lng={longitude.ToString(CultureInfo.InvariantCulture)}&rank_token={Globals.rank_token}×tamp={(int)(DateTime.Now - new DateTime(1970, 1, 1).ToLocalTime()).TotalSeconds}"; 12 | 13 | return Request.Send("map/search/" + data); 14 | } 15 | 16 | public Response Story(double latitude, double longitude) 17 | { 18 | dynamic data = new JObject(); 19 | data._uuid = Globals.uuid; 20 | data._uid = Globals.username_id; 21 | data._csrftoken = Globals.token; 22 | 23 | return Request.Send("map/location_stories/", data.ToString()); 24 | } 25 | 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/requests/Media.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.responses; 2 | using InstagramPrivateAPI.src.responses.feed; 3 | using InstagramPrivateAPI.src.responses.media; 4 | using Newtonsoft.Json.Linq; 5 | 6 | namespace InstagramPrivateAPI.src.requests 7 | { 8 | internal class Media 9 | { 10 | public MediaInfoResponse GetInfo(string mediaId) 11 | { 12 | dynamic data = new JObject(); 13 | data._uuid = Globals.uuid; 14 | data._uid = Globals.username_id; 15 | data._csrftoken = Globals.token; 16 | data.media_id = mediaId; 17 | 18 | return Request.Send("media/" + mediaId + "/info/", data.ToString()); 19 | } 20 | 21 | public Response Delete(string mediaId) 22 | { 23 | dynamic data = new JObject(); 24 | data._uuid = Globals.uuid; 25 | data._uid = Globals.username_id; 26 | data._csrftoken = Globals.token; 27 | data.media_id = mediaId; 28 | 29 | return Request.Send("media/" + mediaId + "/delete/", data.ToString()); 30 | } 31 | 32 | public MediaInfoResponse Edit(string mediaId, string text) 33 | { 34 | dynamic data = new JObject(); 35 | data.caption_text = text; 36 | 37 | return Request.Send("media/" + mediaId + "/edit_media/", data.ToString()); 38 | } 39 | 40 | public Response Like(string mediaId) 41 | { 42 | dynamic data = new JObject(); 43 | data._uuid = Globals.uuid; 44 | data._uid = Globals.username_id; 45 | data._csrftoken = Globals.token; 46 | data.media_id = mediaId; 47 | data.radio_type = "wifi-none"; 48 | data.container_module = "feed_timeline"; 49 | data.is_carousel_bumped_post = false; 50 | data.device_id = Globals.device_id; 51 | 52 | 53 | return Request.Send("media/" + mediaId + "/like/", data.ToString()); 54 | } 55 | 56 | public Response Unlike(string mediaId) 57 | { 58 | dynamic data = new JObject(); 59 | data._uuid = Globals.uuid; 60 | data._uid = Globals.username_id; 61 | data._csrftoken = Globals.token; 62 | data.media_id = mediaId; 63 | 64 | return Request.Send("media/" + mediaId + "/unlike/", data.ToString()); 65 | } 66 | 67 | public FeedUsersResponse GetLikers(string mediaId) => Request.Send("media/" + mediaId + "/likers/"); 68 | 69 | public MediaCommentResponse comment(string mediaId, string commentText) 70 | { 71 | dynamic data = new JObject(); 72 | data._uuid = Globals.uuid; 73 | data._uid = Globals.username_id; 74 | data._csrftoken = Globals.token; 75 | data.comment_text = commentText; 76 | 77 | return Request.Send("media/" + mediaId + "/comment/", data.ToString()); 78 | } 79 | 80 | public MediaCommentsResponse GetComments(string mediaId, string maxId = null) 81 | { 82 | maxId = maxId != null ? maxId : ""; 83 | return Request.Send("media/" + mediaId + "/comments/?max_id=" + maxId); 84 | } 85 | 86 | public Response DeletComment(string mediaId, string commentId) 87 | { 88 | dynamic data = new JObject(); 89 | data._uuid = Globals.uuid; 90 | data._uid = Globals.username_id; 91 | data._csrftoken = Globals.token; 92 | 93 | return Request.Send("media/" + mediaId + "/comment/" + commentId + "/delete/", data.ToString()); 94 | } 95 | 96 | public Response LikeComment(string commentId) 97 | { 98 | dynamic data = new JObject(); 99 | data._uuid = Globals.uuid; 100 | data._uid = Globals.username_id; 101 | data._csrftoken = Globals.token; 102 | 103 | return Request.Send("media/" + commentId + "/comment_like/", data.ToString()); 104 | } 105 | 106 | public Response UnlikeComment(string commentId) 107 | { 108 | dynamic data = new JObject(); 109 | data._uuid = Globals.uuid; 110 | data._uid = Globals.username_id; 111 | data._csrftoken = Globals.token; 112 | 113 | return Request.Send("media/" + commentId + "/comment_unlike/", data.ToString()); 114 | } 115 | 116 | public Response Save(string mediaId) 117 | { 118 | dynamic data = new JObject(); 119 | data._uuid = Globals.uuid; 120 | data._uid = Globals.username_id; 121 | data._csrftoken = Globals.token; 122 | 123 | return Request.Send("media/" + mediaId + "/save/", data.ToString()); 124 | } 125 | 126 | public Response UnSave(string mediaId) 127 | { 128 | dynamic data = new JObject(); 129 | data._uuid = Globals.uuid; 130 | data._uid = Globals.username_id; 131 | data._csrftoken = Globals.token; 132 | 133 | return Request.Send("media/" + mediaId + "/unsave/", data.ToString()); 134 | } 135 | 136 | public Response GetBlockedMedia() 137 | { 138 | dynamic data = new JObject(); 139 | data._uuid = Globals.uuid; 140 | data._uid = Globals.username_id; 141 | data._csrftoken = Globals.token; 142 | 143 | return Request.Send("media/blocked/", data.ToString()); 144 | } 145 | 146 | public string GetID(string url) 147 | { 148 | string[] urlexplode = url.Split(new[] { "/" }, StringSplitOptions.None); 149 | string code = urlexplode[4]; 150 | char[] alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".ToCharArray(); 151 | 152 | long n = 0; 153 | for (int i = 0; i < code.Length; i++) 154 | { 155 | var c = code[i]; 156 | n = n * 64 + Array.IndexOf(alphabet, c); 157 | 158 | if (i == 10) break; 159 | } 160 | return n.ToString(); 161 | } 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /src/requests/People.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.responses.friendships; 2 | using InstagramPrivateAPI.src.responses.news; 3 | using InstagramPrivateAPI.src.responses.users; 4 | using Newtonsoft.Json.Linq; 5 | 6 | namespace InstagramPrivateAPI.src.requests 7 | { 8 | internal class People 9 | { 10 | public UserResponse GetInfoByName(string username) => Request.Send("users/" + username + "/usernameinfo/"); 11 | 12 | public UserResponse GetInfoById(string userId) => Request.Send("users/" + userId + "/info/"); 13 | 14 | public UserResponse GetFullInfoById(string userId) => Request.Send("users/" + userId + "/full_detail_info/"); 15 | 16 | public UserResponse GetSelfInfo() => GetInfoById(Globals.username_id); 17 | 18 | public NewsInboxResponse GetRecentActivityInbox() => Request.Send("news/inbox/?activity_module=all&show_su=true"); 19 | 20 | public FreindshipsShowResponse GetFriendship(string userId) => Request.Send("friendships/show/" + userId); 21 | 22 | public FreindshipStatusResponse RemoveFollower(string userId) 23 | { 24 | dynamic data = new JObject(); 25 | data._uuid = Globals.uuid; 26 | data._uid = Globals.username_id; 27 | data._csrftoken = Globals.token; 28 | data.user_id = userId; 29 | 30 | return Request.Send("friendships/remove_follower/" + userId + "/", data.ToString()); 31 | } 32 | 33 | public FreindshipsFollowingResponse GetFollowing(string userId, string maxId = null) => Request.Send("friendships/" + userId + "/following/?rank_token=" + Globals.rank_token + "&max_id=" + (maxId != null ? maxId : "")); 34 | 35 | public FreindshipsFollowersResponse GetFollowers(string userId, string maxId = null) => Request.Send("friendships/" + userId + "/followers/?rank_token=" + Globals.rank_token + "&max_id=" + (maxId != null ? maxId : "")); 36 | 37 | // query = username or name 38 | public UsersSearchResponse Search(string query) => Request.Send("users/search/?rank_token=" + Globals.rank_token + "query" + query); 39 | 40 | public FreindshipStatusResponse Follow(string userId, string mediaId = null) 41 | { 42 | dynamic data = new JObject(); 43 | data._uuid = Globals.uuid; 44 | data._uid = Globals.username_id; 45 | data.user_id = userId; 46 | data._csrftoken = Globals.csrftoken; 47 | data.radio_type = "wifi-none"; 48 | data.device_id = Globals.device_id; 49 | 50 | if (mediaId != null) 51 | data.media_id_attribution = mediaId; 52 | 53 | 54 | return Request.Send("friendships/create/" + userId + "/", data.ToString()); 55 | } 56 | 57 | public FreindshipStatusResponse Unfollow(string userId) 58 | { 59 | dynamic data = new JObject(); 60 | data._uuid = Globals.uuid; 61 | data._uid = Globals.username_id; 62 | data.user_id = userId; 63 | data._csrftoken = Globals.csrftoken; 64 | data.radio_type = "wifi-none"; 65 | data.device_id = Globals.device_id; 66 | 67 | return Request.Send("friendships/destroy/" + userId + "/", data.ToString()); 68 | } 69 | 70 | public FreindshipStatusResponse TurnOnUserNotification(string userId) 71 | { 72 | dynamic data = new JObject(); 73 | data._uuid = Globals.uuid; 74 | data._uid = Globals.username_id; 75 | data._csrftoken = Globals.token; 76 | 77 | return Request.Send("friendships/favorite/" + userId + "/", data.ToString()); 78 | } 79 | 80 | public FreindshipStatusResponse TurnOffUserNotification(string userId) 81 | { 82 | dynamic data = new JObject(); 83 | data._uuid = Globals.uuid; 84 | data._uid = Globals.username_id; 85 | data._csrftoken = Globals.token; 86 | 87 | return Request.Send("friendships/unfavorite/" + userId + "/", data.ToString()); 88 | } 89 | 90 | public FreindshipStatusResponse Block(string userId) 91 | { 92 | dynamic data = new JObject(); 93 | data._uuid = Globals.uuid; 94 | data._uid = Globals.username_id; 95 | data.user_id = userId; 96 | data._csrftoken = Globals.token; 97 | 98 | return Request.Send("friendships/block/" + userId + "/", data.ToString()); 99 | } 100 | 101 | public FreindshipStatusResponse Unblock(string userId) 102 | { 103 | dynamic data = new JObject(); 104 | data._uuid = Globals.uuid; 105 | data._uid = Globals.username_id; 106 | data.user_id = userId; 107 | data._csrftoken = Globals.token; 108 | 109 | return Request.Send("friendships/unblock/" + userId + "/", data.ToString()); 110 | } 111 | 112 | public UsersBlockedListResponse GetBlockedList() => Request.Send("users/blocked_list/"); 113 | 114 | public FreindshipStatusResponse BlockStory(string userId) 115 | { 116 | dynamic data = new JObject(); 117 | data._uuid = Globals.uuid; 118 | data._uid = Globals.username_id; 119 | data.source = "profile"; 120 | data._csrftoken = Globals.token; 121 | 122 | return Request.Send("friendships/block_friend_reel/" + userId + "/", data.ToString()); 123 | } 124 | 125 | public FreindshipStatusResponse UnblockStory(string userId) 126 | { 127 | dynamic data = new JObject(); 128 | data._uuid = Globals.uuid; 129 | data._uid = Globals.username_id; 130 | data.source = "profile"; 131 | data._csrftoken = Globals.token; 132 | 133 | return Request.Send("friendships/unblock_friend_reel/" + userId + "/", data.ToString()); 134 | } 135 | 136 | public UserResponse GetBlockedStoryList() 137 | { 138 | dynamic data = new JObject(); 139 | data._uuid = Globals.uuid; 140 | data._uid = Globals.username_id; 141 | data._csrftoken = Globals.token; 142 | 143 | return Request.Send("friendships/blocked_reels/", data.ToString()); 144 | } 145 | 146 | public FreindshipStatusResponse muteFriendStory(string userId) 147 | { 148 | dynamic data = new JObject(); 149 | data._uuid = Globals.uuid; 150 | data._uid = Globals.username_id; 151 | data._csrftoken = Globals.token; 152 | 153 | return Request.Send($"friendships/mute_friend_reel/{userId}/", data.ToString()); 154 | } 155 | 156 | public FreindshipStatusResponse unmuteFriendStory(string userId) 157 | { 158 | dynamic data = new JObject(); 159 | data._uuid = Globals.uuid; 160 | data._uid = Globals.username_id; 161 | data._csrftoken = Globals.token; 162 | 163 | return Request.Send($"friendships/unmute_friend_reel/{userId}/", data.ToString()); 164 | } 165 | 166 | public string GetUserId(string username) => GetInfoByName(username).user.pk.ToString(); 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /src/requests/Request.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.responses; 2 | using InstagramPrivateAPI.src.utils; 3 | using Newtonsoft.Json; 4 | using Newtonsoft.Json.Linq; 5 | using System.Net; 6 | using System.Runtime.Serialization.Formatters.Binary; 7 | using System.Text; 8 | 9 | namespace InstagramPrivateAPI.src.requests 10 | { 11 | internal class Request 12 | { 13 | public static CookieContainer Cookies = new CookieContainer(); 14 | private static HttpWebResponse postResponse; 15 | public static T Send(string endpoint, string post = null, bool login = false, int version = 0) where T : Response 16 | { 17 | if (!Globals.isLoggedIn && !login) 18 | Console.WriteLine("Not logged in!"); 19 | 20 | Console.WriteLine($"Debugging ... {endpoint}"); 21 | HttpWebRequest postReq = (HttpWebRequest)WebRequest.Create(Constants.API_URLS[version] + endpoint); 22 | postReq.AutomaticDecompression = DecompressionMethods.GZip; 23 | WebHeaderCollection postHeaders = postReq.Headers; 24 | postReq.KeepAlive = true; 25 | postReq.Accept = "*/*"; 26 | postReq.UserAgent = Constants.UserAgent; 27 | postReq.ContentType = Constants.CONTENT_TYPE; 28 | postReq.CookieContainer = Cookies; 29 | postHeaders.Add("Cookie2", "$Version=1"); 30 | postHeaders.Add("Accept-Language", Constants.ACCEPT_LANGUAGE); 31 | postHeaders.Add("X-IG-Connection-Type", Constants.X_IG_Connection_Type); 32 | //POST 33 | if (post != null) 34 | { 35 | byte[] bytes = ASCIIEncoding.UTF8.GetBytes("signed_body=" + Signatures.HMAC(post, Constants.IG_SIG_KEY) + "." + Signatures.EncodeUrl(post)); 36 | postReq.Method = "POST"; 37 | Stream postStream = postReq.GetRequestStream(); 38 | postStream.Write(bytes, 0, bytes.Length); 39 | postStream.Close(); 40 | } 41 | try 42 | { 43 | postResponse = (HttpWebResponse)postReq.GetResponse(); 44 | if (postResponse.StatusCode == HttpStatusCode.OK) 45 | { 46 | StreamReader reader = new StreamReader(postResponse.GetResponseStream()); 47 | Globals.LastResponse = reader.ReadToEnd(); 48 | try 49 | { 50 | Globals.csrftoken = postResponse.Cookies["csrftoken"].Value.ToUpper(); 51 | } 52 | catch { } 53 | } 54 | else 55 | Console.WriteLine("Request return " + postResponse.StatusCode + " error"); 56 | 57 | } 58 | catch (WebException e) 59 | { 60 | Globals.LastResponse = new StreamReader(e.Response.GetResponseStream()).ReadToEnd(); 61 | } 62 | return JsonConvert.DeserializeObject(Globals.LastResponse); 63 | } 64 | 65 | public static void ReadCookies(String session_fname) => Cookies = ReadCookiesFromDisk(session_fname); 66 | 67 | public static void UseCookies(string cookie_fname = "cookie_data.txt", string session_fname = "session.txt") 68 | { 69 | JObject cookie = new JObject(); 70 | foreach (Cookie cook in postResponse.Cookies) 71 | { 72 | string name = cook.ToString().Split('=')[0]; 73 | string value = cook.ToString().Split('=')[1]; 74 | 75 | cookie.Add(new JProperty(name, value)); 76 | } 77 | SaveCookiesData(cookie_fname, cookie.ToString()); 78 | 79 | WriteCookiesToDisk(session_fname, Cookies); 80 | } 81 | 82 | public static void SaveCookiesData(string file, string cookie) => File.WriteAllText(file, cookie); 83 | 84 | public static string LoadCookiesData(string file) => File.ReadAllText(file); 85 | 86 | public static void WriteCookiesToDisk(string file, CookieContainer cookieJar) 87 | { 88 | using (Stream stream = File.Create(file)) 89 | { 90 | try 91 | { 92 | Console.Out.Write("Writing cookies to disk... "); 93 | BinaryFormatter formatter = new BinaryFormatter(); 94 | formatter.Serialize(stream, cookieJar); 95 | Console.Out.WriteLine("Done."); 96 | } 97 | catch (Exception e) 98 | { 99 | Console.Out.WriteLine("Problem writing cookies to disk: " + e.GetType()); 100 | } 101 | } 102 | } 103 | 104 | public static CookieContainer ReadCookiesFromDisk(string file) 105 | { 106 | try 107 | { 108 | using (Stream stream = File.Open(file, FileMode.Open)) 109 | { 110 | Console.Out.Write("Reading cookies from disk... "); 111 | BinaryFormatter formatter = new BinaryFormatter(); 112 | Console.Out.WriteLine("Done."); 113 | return (CookieContainer)formatter.Deserialize(stream); 114 | } 115 | } 116 | catch (Exception e) 117 | { 118 | Console.Out.WriteLine("Problem reading cookies from disk: " + e.GetType()); 119 | return new CookieContainer(); 120 | } 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/requests/Story.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.responses; 2 | using InstagramPrivateAPI.src.responses.feed; 3 | using InstagramPrivateAPI.src.responses.media; 4 | using InstagramPrivateAPI.src.responses.users; 5 | 6 | namespace InstagramPrivateAPI.src.requests 7 | { 8 | internal class Story 9 | { 10 | public FeedReelsTrayResponse getReelsTrayFeed() => Request.Send("feed/reels_tray/"); 11 | 12 | public FeedUserReelsMediaResponse getUserReelMediaFeed(string userId) => Request.Send($"feed/user/{userId}/reel_media/"); 13 | 14 | public FeedUserStoryResponse getUserStoryFeed(string userId) => Request.Send($"feed/user/{userId}/story/"); 15 | 16 | //Works for your own story items 17 | public MediaListReelMediaViewerResponse getStoryItemViewers(string storyPk, string maxId = null) => Request.Send($"media/{storyPk}/list_reel_media_viewer/?max_id=" + (maxId != null ? maxId : "")); 18 | 19 | public UserReelSettingsResponse getReelSettings() => Request.Send("users/reel_settings/"); 20 | 21 | public Response getArchivedStoriesFeed() => Request.Send("archive/reel/day_shells/?include_cover=0"); 22 | 23 | public Response markMediaSeen(string itemSourceId, string itemId, string itemTakenAt) => Internal.markStoryMediaSeen(itemSourceId, itemId, itemTakenAt); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/requests/Timeline.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.responses.feed; 2 | using Newtonsoft.Json.Linq; 3 | 4 | namespace InstagramPrivateAPI.src.requests 5 | { 6 | internal class Timeline 7 | { 8 | public FeedTimelineResponse GetTimelineFeed(string max_id = null) 9 | { 10 | dynamic data = new JObject(); 11 | data._csrftoken = Globals.csrftoken; 12 | data._uuid = Globals.uuid; 13 | data.is_prefetch = "0"; 14 | data.phone_id = Globals.phone_id; 15 | data.device_id = Globals.device_id; 16 | data.battery_level = "100"; 17 | data.is_charging = "1"; 18 | data.will_sound_on = "1"; 19 | data.timezone_offset = DateTimeOffset.Now.Offset.TotalSeconds; 20 | data.client_session_id = Globals.session_id; 21 | data.bloks_versioning_id = Constants.BLOCK_VERSIONING_ID; 22 | 23 | if (max_id != null) 24 | { 25 | data.reason = "pagination"; 26 | data.is_pull_to_refresh = "0"; 27 | } 28 | 29 | return Request.Send("feed/timeline/?max_id=" + max_id, data.ToString()); 30 | } 31 | 32 | public FeedUsersResponse GetUserFeed(string userId, string maxId = null) => Request.Send("feed/user/" + userId + "/?&exclude_comment=true&only_fetch_first_carousel_media=true" + (maxId != null ? maxId : "")); 33 | 34 | public FeedUsersResponse GetSelfFeed(string maxId = null, string minTimestamp = null) => GetUserFeed(Globals.username_id, maxId); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/responses/Response.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace InstagramPrivateAPI.src.responses 4 | { 5 | internal class Response 6 | { 7 | public string status { get; set; } 8 | private int statusCode { get; set; } 9 | private string statusCmessageode { get; set; } 10 | private bool spam { get; set; } 11 | //private bool lock { get; set; } 12 | private string feedback_title { get; set; } 13 | private string feedback_message { get; set; } 14 | private string error_type { get; set; } 15 | private string checkpoint_url { get; set; } 16 | 17 | public override string ToString() => JsonConvert.SerializeObject(this); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/responses/accounts/AccountsUserResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.user; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.accounts 5 | { 6 | internal class AccountsUserResponse 7 | { 8 | public User user; 9 | 10 | public override string ToString() 11 | { 12 | return JsonConvert.SerializeObject(this); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/responses/accounts/CheckUsernameResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace InstagramPrivateAPI.src.responses.accounts 4 | { 5 | internal class CheckUsernameResponse : Response 6 | { 7 | public class Suggestion 8 | { 9 | public string username { get; set; } 10 | public string prototype { get; set; } 11 | } 12 | 13 | public class SuggestionsWithMetadata 14 | { 15 | public List suggestions { get; set; } 16 | } 17 | 18 | public class UsernameSuggestions 19 | { 20 | public SuggestionsWithMetadata suggestions_with_metadata { get; set; } 21 | } 22 | public string username { get; set; } 23 | public bool available { get; set; } 24 | public bool existing_user_password { get; set; } 25 | public string error { get; set; } 26 | public UsernameSuggestions username_suggestions { get; set; } 27 | public string status { get; set; } 28 | public string error_type { get; set; } 29 | public override string ToString() => JsonConvert.SerializeObject(this); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/responses/accounts/LoginResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.user; 2 | using InstagramPrivateAPI.src.responses.challenge; 3 | using Newtonsoft.Json; 4 | 5 | namespace InstagramPrivateAPI.src.responses.accounts 6 | { 7 | internal class LoginResponse : Response 8 | { 9 | public User logged_in_user { get; set; } 10 | public Challenge challenge { get; set; } 11 | public TwoFactorInfo two_factor_info { get; set; } 12 | 13 | public override string ToString() 14 | { 15 | return JsonConvert.SerializeObject(this); 16 | } 17 | 18 | public class TwoFactorInfo 19 | { 20 | public string two_factor_identifier { get; set; } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/responses/challenge/Challenge.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace InstagramPrivateAPI.src.responses.challenge 8 | { 9 | internal class Challenge 10 | { 11 | private String url { get; set; } 12 | private String api_path { get; set; } 13 | private String challenge_context { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/responses/direct/DirectGetPresenceResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace InstagramPrivateAPI.src.responses.direct 4 | { 5 | internal class DirectGetPresenceResponse : Response 6 | { 7 | public Dictionary user_presence { get; set; } 8 | 9 | public class UserPresence 10 | { 11 | public bool is_active { get; set; } 12 | public long last_activity_at_ms { get; set; } 13 | } 14 | public override string ToString() => JsonConvert.SerializeObject(this); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/responses/direct/DirectInboxResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.direct; 2 | using InstagramPrivateAPI.src.models.user; 3 | using Newtonsoft.Json; 4 | 5 | namespace InstagramPrivateAPI.src.responses.direct 6 | { 7 | internal class DirectInboxResponse : Response 8 | { 9 | public User viewer { get; set; } 10 | public Inbox inbox { get; set; } 11 | public int seq_id { get; set; } 12 | public object mixed_pending_inbox_sequence_id { get; set; } 13 | public long snapshot_at_ms { get; set; } 14 | public int pending_requests_total { get; set; } 15 | public bool has_pending_top_requests { get; set; } 16 | public override string ToString() => JsonConvert.SerializeObject(this); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/responses/direct/ThreadResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.direct; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.direct 5 | { 6 | internal class ThreadResponse : Response 7 | { 8 | public IGThread thread { get; set; } 9 | public override string ToString() => JsonConvert.SerializeObject(this); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/responses/discover/DiscoverTopicalExploreResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.discover; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.discover 5 | { 6 | internal class DiscoverTopicalExploreResponse : Response 7 | { 8 | public List sectional_items; 9 | public String rank_token; 10 | public List clusters; 11 | public String next_max_id; 12 | public bool more_available; 13 | 14 | public override string ToString() => JsonConvert.SerializeObject(this); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/responses/feed/FeedLocationResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.feed; 2 | using InstagramPrivateAPI.src.models.location; 3 | using InstagrampublicAPI.src.models.media.timeline; 4 | using Newtonsoft.Json; 5 | 6 | namespace InstagramPrivateAPI.src.responses.feed 7 | { 8 | internal class FeedLocationResponse : Response 9 | { 10 | public List ranked_items { get; set; } 11 | public List items { get; set; } 12 | public int num_results { get; set; } 13 | public string next_max_id { get; set; } 14 | public bool more_available { get; set; } 15 | public bool auto_load_more_enabled { get; set; } 16 | public Reel story { get; set; } 17 | public int media_count { get; set; } 18 | public Location location { get; set; } 19 | 20 | public override string ToString() => JsonConvert.SerializeObject(this); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/responses/feed/FeedReelsTrayResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.feed; 2 | using InstagramPrivateAPI.src.models.live; 3 | using Newtonsoft.Json; 4 | 5 | namespace InstagramPrivateAPI.src.responses.feed 6 | { 7 | internal class FeedReelsTrayResponse : Response 8 | { 9 | public List tray { get; set; } 10 | public List broadcasts { get; set; } 11 | public int sticker_version { get; set; } 12 | public int face_filter_nux_version { get; set; } 13 | public bool stories_viewer_gestures_nux_eligible { get; set; } 14 | public int response_timestamp { get; set; } 15 | public string story_ranking_token { get; set; } 16 | 17 | public override string ToString() 18 | { 19 | return JsonConvert.SerializeObject(this); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/responses/feed/FeedTagResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.feed; 2 | using InstagrampublicAPI.src.models.media.timeline; 3 | using Newtonsoft.Json; 4 | 5 | namespace InstagramPrivateAPI.src.responses.feed 6 | { 7 | internal class FeedTagResponse : Response 8 | { 9 | public List ranked_items { get; set; } 10 | public List items { get; set; } 11 | public Reel story { get; set; } 12 | public int num_results { get; set; } 13 | public String next_max_id { get; set; } 14 | public bool more_available { get; set; } 15 | public override string ToString() => JsonConvert.SerializeObject(this); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/responses/feed/FeedTimelineResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagrampublicAPI.src.models.media.timeline; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.feed 5 | { 6 | internal class FeedTimelineResponse : Response 7 | { 8 | public int num_results { get; set; } 9 | public bool more_available { get; set; } 10 | public bool auto_load_more_enabled { get; set; } 11 | public bool is_direct_v2_enabled { get; set; } 12 | public string next_max_id { get; set; } 13 | public string view_state_version { get; set; } 14 | public bool client_feed_changelist_applied { get; set; } 15 | public string request_id { get; set; } 16 | public int pull_to_refresh_window_ms { get; set; } 17 | public int preload_distance { get; set; } 18 | public string feed_pill_text { get; set; } 19 | public int hide_like_and_view_counts { get; set; } 20 | public int max_num_possible_ad_insertions { get; set; } 21 | public long last_head_load_ms { get; set; } 22 | public List items { get; set; } 23 | public override string ToString() => JsonConvert.SerializeObject(this); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/responses/feed/FeedUserReelsMediaResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.feed; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.feed 5 | { 6 | internal class FeedUserReelsMediaResponse : Response 7 | { 8 | public Reel reel { get; set; } 9 | 10 | public override string ToString() 11 | { 12 | return JsonConvert.SerializeObject(this); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/responses/feed/FeedUserStoryResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.feed; 2 | using InstagramPrivateAPI.src.models.live; 3 | using Newtonsoft.Json; 4 | 5 | namespace InstagramPrivateAPI.src.responses.feed 6 | { 7 | internal class FeedUserStoryResponse : Response 8 | { 9 | public Broadcast broadcast { get; set; } 10 | public Reel reel { get; set; } 11 | 12 | public override string ToString() => JsonConvert.SerializeObject(this); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/responses/feed/FeedUsersResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.media; 2 | using InstagramPrivateAPI.src.models.user; 3 | using Newtonsoft.Json; 4 | 5 | namespace InstagramPrivateAPI.src.responses.feed 6 | { 7 | internal class FeedUsersResponse : Response 8 | { 9 | public List items { get; set; } 10 | public int num_results { get; set; } 11 | public bool more_available { get; set; } 12 | public string next_max_id { get; set; } 13 | public User user { get; set; } 14 | public bool auto_load_more_enabled { get; set; } 15 | 16 | public bool isMore_available() => next_max_id != null; 17 | 18 | public override string ToString() => JsonConvert.SerializeObject(this); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/responses/friendships/FreindshipStatusResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.friendships; 2 | 3 | namespace InstagramPrivateAPI.src.responses.friendships 4 | { 5 | internal class FreindshipStatusResponse : Response 6 | { 7 | public Friendship friendship_status; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/responses/friendships/FreindshipsFollowersResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.friendships; 2 | using InstagramPrivateAPI.src.models.user; 3 | using Newtonsoft.Json; 4 | 5 | namespace InstagramPrivateAPI.src.responses.friendships 6 | { 7 | internal class FreindshipsFollowersResponse : Response 8 | { 9 | public List users { get; set; } 10 | public bool big_list { get; set; } 11 | public int page_size { get; set; } 12 | public List groups { get; set; } 13 | public bool more_groups_available { get; set; } 14 | public FriendRequests friend_requests { get; set; } 15 | public bool should_limit_list_of_followers { get; set; } 16 | public override string ToString() => JsonConvert.SerializeObject(this); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/responses/friendships/FreindshipsFollowingResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.user; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.friendships 5 | { 6 | internal class FreindshipsFollowingResponse : Response 7 | { 8 | public List users { get; set; } 9 | public bool big_list { get; set; } 10 | public int page_size { get; set; } 11 | public bool should_limit_list_of_followers { get; set; } 12 | public override string ToString() => JsonConvert.SerializeObject(this); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/responses/friendships/FreindshipsShowResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.friendships; 2 | 3 | namespace InstagramPrivateAPI.src.responses.friendships 4 | { 5 | internal class FreindshipsShowResponse : Response 6 | { 7 | public Friendship friendship; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/responses/live/LiveBroadcastCommentResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.media.timeline; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.live 5 | { 6 | internal class LiveBroadcastCommentResponse : Response 7 | { 8 | public Comment comment { get; set; } 9 | public override string ToString() => JsonConvert.SerializeObject(this); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/responses/live/LiveBroadcastGetCommentResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.media.timeline; 2 | using Newtonsoft.Json; 3 | using static InstagramPrivateAPI.src.models.media.timeline.Comment; 4 | 5 | namespace InstagramPrivateAPI.src.responses.live 6 | { 7 | internal class LiveBroadcastGetCommentResponse : Response 8 | { 9 | public bool comment_likes_enabled { get; set; } 10 | public List comments { get; set; } 11 | public int comment_count { get; set; } 12 | public Caption caption { get; set; } 13 | public bool caption_is_edited { get; set; } 14 | public bool has_more_comments { get; set; } 15 | public bool has_more_headload_comments { get; set; } 16 | public string media_header_display { get; set; } 17 | public bool can_view_more_preview_comments { get; set; } 18 | public int live_seconds_per_comment { get; set; } 19 | public string is_first_fetch { get; set; } 20 | public List visible_comments { get; set; } 21 | public List system_comments { get; set; } 22 | public int comment_muted { get; set; } 23 | public bool is_viewer_comment_allowed { get; set; } 24 | public override string ToString() => JsonConvert.SerializeObject(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/responses/live/LiveBroadcastGetViewerListResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.user; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.live 5 | { 6 | internal class LiveBroadcastGetViewerListResponse : Response 7 | { 8 | public List users { get; set; } 9 | public int total_unique_viewer_count { get; set; } 10 | public string total_unique_viewer_count_formatted { get; set; } 11 | public override string ToString() => JsonConvert.SerializeObject(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/responses/live/LiveBroadcastHeartbeatResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace InstagramPrivateAPI.src.responses.live 4 | { 5 | internal class LiveBroadcastHeartbeatResponse : Response 6 | { 7 | public int viewer_count { get; set; } 8 | public String broadcast_status { get; set; } 9 | public String[] cobroadcaster_ids { get; set; } 10 | public int offset_to_video_start { get; set; } 11 | public override string ToString() => JsonConvert.SerializeObject(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/responses/live/LiveBroadcastLikeResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace InstagramPrivateAPI.src.responses.live 4 | { 5 | internal class LiveBroadcastLikeResponse : Response 6 | { 7 | public String likes; 8 | public String burst_likes; 9 | 10 | public class LiveBroadcastGetLikeCountResponse : LiveBroadcastLikeResponse 11 | { 12 | public int likes { get; set; } 13 | public int burst_likes { get; set; } 14 | public List likers { get; set; } 15 | public int like_ts { get; set; } 16 | 17 | public class Liker 18 | { 19 | public String user_id; 20 | public String profile_pic_url; 21 | public int count; 22 | } 23 | } 24 | public override string ToString() => JsonConvert.SerializeObject(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/responses/live/LiveBroadcastThumbnailsResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace InstagramPrivateAPI.src.responses.live 4 | { 5 | internal class LiveBroadcastThumbnailsResponse : Response 6 | { 7 | public List thumbnails { get; set; } 8 | public override string ToString() => JsonConvert.SerializeObject(this); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/responses/live/LiveCreateResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace InstagramPrivateAPI.src.responses.live 4 | { 5 | internal class LiveCreateResponse : Response 6 | { 7 | public long broadcast_id { get; set; } 8 | public string upload_url { get; set; } 9 | public string fbvp_tcp_upload_url { get; set; } 10 | public string fbvp_quic_upload_url { get; set; } 11 | public int max_time_in_seconds { get; set; } 12 | public int speed_test_ui_timeout { get; set; } 13 | public int stream_network_speed_test_payload_chunk_size_in_bytes { get; set; } 14 | public int stream_network_speed_test_payload_size_in_bytes { get; set; } 15 | public int stream_network_speed_test_payload_timeout_in_seconds { get; set; } 16 | public int speed_test_minimum_bandwidth_threshold { get; set; } 17 | public int speed_test_retry_max_count { get; set; } 18 | public int speed_test_retry_time_delay { get; set; } 19 | public int disable_speed_test { get; set; } 20 | public int stream_video_allow_b_frames { get; set; } 21 | public int stream_video_width { get; set; } 22 | public int stream_video_bit_rate { get; set; } 23 | public int stream_video_fps { get; set; } 24 | public int stream_audio_bit_rate { get; set; } 25 | public int stream_audio_sample_rate { get; set; } 26 | public int stream_audio_channels { get; set; } 27 | public int heartbeat_interval { get; set; } 28 | public int broadcaster_update_frequency { get; set; } 29 | public string stream_video_adaptive_bitrate_config { get; set; } 30 | public int stream_network_connection_retry_count { get; set; } 31 | public int stream_network_connection_retry_delay_in_seconds { get; set; } 32 | public int connect_with_1rtt { get; set; } 33 | public int allow_resolution_change { get; set; } 34 | public int avc_rtmp_payload { get; set; } 35 | public int pass_thru_enabled { get; set; } 36 | public int live_trace_enabled { get; set; } 37 | public int live_trace_sample_interval_in_seconds { get; set; } 38 | public int live_trace_sampling_source { get; set; } 39 | public int server_abr_enabled { get; set; } 40 | public int is_premium { get; set; } 41 | public int max_allowed_participants { get; set; } 42 | public bool should_use_rsys_rtc_infra { get; set; } 43 | public string badge_setting { get; set; } 44 | public StreamInitialBitratePrediction stream_initial_bitrate_prediction { get; set; } 45 | 46 | public class StreamInitialBitratePrediction 47 | { 48 | public double noresult { get; set; } 49 | } 50 | 51 | public String getBroadcastUrl() => upload_url.Split(broadcast_id.ToString(), 2)[0]; 52 | 53 | public String getBroadcastKey() => broadcast_id + upload_url.Split(broadcast_id.ToString(), 2)[1]; 54 | public override string ToString() => JsonConvert.SerializeObject(this); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/responses/live/LiveInfoResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.live; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.live 5 | { 6 | internal class LiveInfoResponse : Response 7 | { 8 | public Info info { get; set; } 9 | public override string ToString() => JsonConvert.SerializeObject(this); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/responses/live/LiveJoinRequestsResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.user; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.live 5 | { 6 | internal class LiveJoinRequestsResponse : Response 7 | { 8 | public List users { get; set; } 9 | public override string ToString() => JsonConvert.SerializeObject(this); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/responses/live/LiveQuastionStatusResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace InstagramPrivateAPI.src.responses.live 4 | { 5 | internal class LiveQuastionStatusResponse : Response 6 | { 7 | public bool is_question_submission_allowed { get; set; } 8 | public override string ToString() => JsonConvert.SerializeObject(this); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/responses/live/LiveStartResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace InstagramPrivateAPI.src.responses.live 4 | { 5 | internal class LiveStartResponse : Response 6 | { 7 | public String media_id { get; set; } 8 | public override string ToString() => JsonConvert.SerializeObject(this); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/responses/location/LocationInfoResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace InstagramPrivateAPI.src.responses.location 4 | { 5 | internal class LocationInfoResponse : Response 6 | { 7 | public string location_id { get; set; } 8 | public string facebook_places_id { get; set; } 9 | public string name { get; set; } 10 | public string phone { get; set; } 11 | public string website { get; set; } 12 | public string category { get; set; } 13 | public int price_range { get; set; } 14 | public Hours hours { get; set; } 15 | public object lat { get; set; } 16 | public object lng { get; set; } 17 | public string location_address { get; set; } 18 | public string location_city { get; set; } 19 | public int location_region { get; set; } 20 | public string location_zip { get; set; } 21 | public bool show_location_page_survey { get; set; } 22 | public int num_guides { get; set; } 23 | public bool has_menu { get; set; } 24 | public PageEffectInfo page_effect_info { get; set; } 25 | 26 | public class PageEffectInfo 27 | { 28 | public int num_effects { get; set; } 29 | public object thumbnail_url { get; set; } 30 | public object effect { get; set; } 31 | } 32 | 33 | public class Hours : Response 34 | { 35 | public string current_status { get; set; } 36 | public string hours_today { get; set; } 37 | public List schedule { get; set; } 38 | } 39 | public override string ToString() => JsonConvert.SerializeObject(this); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/responses/location/LocationSearchResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.location; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.location 5 | { 6 | internal class LocationSearchResponse : Response 7 | { 8 | public List venues { get; set; } 9 | public string request_id { get; set; } 10 | public string rank_token { get; set; } 11 | public string status { get; set; } 12 | 13 | public override string ToString() => JsonConvert.SerializeObject(this); 14 | 15 | public class Venue : Location 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/responses/media/MediaCommentResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.media.timeline; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.media 5 | { 6 | internal class MediaCommentResponse : Response 7 | { 8 | public Comment comment { get; set; } 9 | public override string ToString() => JsonConvert.SerializeObject(this); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/responses/media/MediaCommentsResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.media.timeline; 2 | using Newtonsoft.Json; 3 | using static InstagramPrivateAPI.src.models.media.timeline.Comment; 4 | 5 | namespace InstagramPrivateAPI.src.responses.media 6 | { 7 | internal class MediaCommentsResponse : Response 8 | { 9 | public bool comment_likes_enabled { get; set; } 10 | public List comments { get; set; } 11 | public int comment_count { get; set; } 12 | public Caption caption { get; set; } 13 | public bool caption_is_edited { get; set; } 14 | public bool has_more_comments { get; set; } 15 | public bool has_more_headload_comments { get; set; } 16 | public bool has_comment_spike { get; set; } 17 | public string media_header_display { get; set; } 18 | public bool initiate_at_top { get; set; } 19 | public bool insert_new_comment_to_top { get; set; } 20 | public bool display_realtime_typing_indicator { get; set; } 21 | public List preview_comments { get; set; } 22 | public bool can_view_more_preview_comments { get; set; } 23 | public int scroll_behavior { get; set; } 24 | public override string ToString() => JsonConvert.SerializeObject(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/responses/media/MediaInfoResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagrampublicAPI.src.models.media.timeline; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.media 5 | { 6 | internal class MediaInfoResponse : Response 7 | { 8 | public List items { get; set; } 9 | public int num_results { get; set; } 10 | public bool more_available { get; set; } 11 | 12 | public override string ToString() 13 | { 14 | return JsonConvert.SerializeObject(this); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/responses/media/MediaListReelMediaViewerResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.media.reel; 2 | using InstagramPrivateAPI.src.models.user; 3 | using Newtonsoft.Json; 4 | 5 | namespace InstagramPrivateAPI.src.responses.media 6 | { 7 | internal class MediaListReelMediaViewerResponse : Response 8 | { 9 | public List users { get; set; } 10 | public String next_max_id { get; set; } 11 | public int user_count { get; set; } 12 | public int total_viewer_count { get; set; } 13 | public ReelMedia updated_media { get; set; } 14 | 15 | public bool isMore_available() => next_max_id != null; 16 | public override string ToString() => JsonConvert.SerializeObject(this); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/responses/news/NewsInboxResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.news; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.news 5 | { 6 | internal class NewsInboxResponse : Response 7 | { 8 | public NewsCounts counts; 9 | public List new_stories; 10 | public List old_stories; 11 | 12 | public class NewsCounts 13 | { 14 | public int likes { get; set; } 15 | public int comments { get; set; } 16 | private int shopping_notification { get; set; } 17 | public int usertags { get; set; } 18 | public int relationships { get; set; } 19 | public int campaign_notification { get; set; } 20 | public int comment_likes { get; set; } 21 | public int photos_of_you { get; set; } 22 | public int requests { get; set; } 23 | } 24 | 25 | public override string ToString() 26 | { 27 | return JsonConvert.SerializeObject(this); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/responses/tags/TagsInfoResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.tags; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.tags 5 | { 6 | internal class TagsInfoResponse : Response 7 | { 8 | public Info info { get; set; } 9 | public override string ToString() => JsonConvert.SerializeObject(this); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/responses/tags/TagsSearchResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace InstagramPrivateAPI.src.responses.tags 4 | { 5 | internal class TagsSearchResponse : Response 6 | { 7 | public String rank_token { get; set; } 8 | public String page_token { get; set; } 9 | public String status { get; set; } 10 | public bool has_more { get; set; } 11 | public List results { get; set; } 12 | 13 | public class SearchTagTag 14 | { 15 | public long id { get; set; } 16 | public String name { get; set; } 17 | public String formatted_media_count { get; set; } 18 | public String search_result_subtitle { get; set; } 19 | public String profile_pic_url { get; set; } 20 | public int media_count { get; set; } 21 | public bool use_default_avatar { get; set; } 22 | } 23 | public override string ToString() => JsonConvert.SerializeObject(this); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/responses/tags/TagsSuggestedResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.tags; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.tags 5 | { 6 | internal class TagsSuggestedResponse : Response 7 | { 8 | public List tags { get; set; } 9 | public override string ToString() => JsonConvert.SerializeObject(this); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/responses/users/UserFollowingTagsResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.tags; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.users 5 | { 6 | internal class UserFollowingTagsResponse : Response 7 | { 8 | public List tags { get; set; } 9 | public override string ToString() => JsonConvert.SerializeObject(this); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/responses/users/UserReelSettingsResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.media.reel; 2 | using InstagramPrivateAPI.src.models.user; 3 | using Newtonsoft.Json; 4 | 5 | namespace InstagramPrivateAPI.src.responses.users 6 | { 7 | internal class UserReelSettingsResponse : Response 8 | { 9 | public string message_prefs { get; set; } 10 | public BlockedReels blocked_reels { get; set; } 11 | public Besties besties { get; set; } 12 | public bool persist_stories_to_private_profile { get; set; } 13 | public string reel_auto_archive { get; set; } 14 | public bool allow_story_reshare { get; set; } 15 | public bool save_to_camera_roll { get; set; } 16 | public bool save_recent_stories_captures { get; set; } 17 | public override string ToString() => JsonConvert.SerializeObject(this); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/responses/users/UserResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.user; 2 | using Newtonsoft.Json; 3 | 4 | namespace InstagramPrivateAPI.src.responses.users 5 | { 6 | internal class UserResponse : Response 7 | { 8 | public User user; 9 | 10 | public override string ToString() => JsonConvert.SerializeObject(this); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/responses/users/UsersBlockedListResponse.cs: -------------------------------------------------------------------------------- 1 | namespace InstagramPrivateAPI.src.responses.users 2 | { 3 | internal class UsersBlockedListResponse : Response 4 | { 5 | public List blocked_list { get; set; } 6 | 7 | public class BlockedUser 8 | { 9 | public long user_id { get; set; } 10 | public String username { get; set; } 11 | public String full_name { get; set; } 12 | public String profile_pic_url { get; set; } 13 | public long block_at { get; set; } 14 | public bool is_auto_block_enabled { get; set; } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/responses/users/UsersSearchResponse.cs: -------------------------------------------------------------------------------- 1 | using InstagramPrivateAPI.src.models.friendships; 2 | using InstagramPrivateAPI.src.models.user; 3 | using Newtonsoft.Json; 4 | 5 | namespace InstagramPrivateAPI.src.responses.users 6 | { 7 | internal class UsersSearchResponse : Response 8 | { 9 | private int num_results { get; set; } 10 | private List users { get; set; } 11 | private bool has_more { get; set; } 12 | private String rank_token { get; set; } 13 | private String page_token { get; set; } 14 | 15 | public class User : Profile 16 | { 17 | Friendship friendship_status { get; set; } 18 | String social_context { get; set; } 19 | String search_social_context { get; set; } 20 | int mutual_followers_count { get; set; } 21 | int latest_reel_media { get; set; } 22 | } 23 | 24 | public override string ToString() => JsonConvert.SerializeObject(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/utils/Devices/GoodDevices.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace InstagramPrivateAPI.src.utils.Devices 8 | { 9 | internal class GoodDevices 10 | { 11 | public static readonly string[] DEVICES = { 12 | /* OnePlus 3T. Released: November 2016. 13 | * https://www.amazon.com/OnePlus-A3010-64GB-Gunmetal-International/dp/B01N4H00V8 14 | * https://www.handsetdetection.com/properties/devices/OnePlus/A3010 15 | */ 16 | "24/7.0; 380dpi; 1080x1920; OnePlus; ONEPLUS A3010; OnePlus3T; qcom", 17 | 18 | /* LG G5. Released: April 2016. 19 | * https://www.amazon.com/LG-Unlocked-Phone-Titan-Warranty/dp/B01DJE22C2 20 | * https://www.handsetdetection.com/properties/devices/LG/RS988 21 | */ 22 | "23/6.0.1; 640dpi; 1440x2392; LGE/lge; RS988; h1; h1", 23 | 24 | /* Huawei Mate 9 Pro. Released: January 2017. 25 | * https://www.amazon.com/Huawei-Dual-Sim-Titanium-Unlocked-International/dp/B01N9O1L6N 26 | * https://www.handsetdetection.com/properties/devices/Huawei/LON-L29 27 | */ 28 | "24/7.0; 640dpi; 1440x2560; HUAWEI; LON-L29; HWLON; hi3660", 29 | 30 | /* ZTE Axon 7. Released: June 2016. 31 | * https://www.frequencycheck.com/models/OMYDK/zte-axon-7-a2017u-dual-sim-lte-a-64gb 32 | * https://www.handsetdetection.com/properties/devices/ZTE/A2017U 33 | */ 34 | "23/6.0.1; 640dpi; 1440x2560; ZTE; ZTE A2017U; ailsa_ii; qcom", 35 | 36 | /* Samsung Galaxy S7 Edge SM-G935F. Released: March 2016. 37 | * https://www.amazon.com/Samsung-SM-G935F-Factory-Unlocked-Smartphone/dp/B01C5OIINO 38 | * https://www.handsetdetection.com/properties/devices/Samsung/SM-G935F 39 | */ 40 | "23/6.0.1; 640dpi; 1440x2560; samsung; SM-G935F; hero2lte; samsungexynos8890", 41 | 42 | /* Samsung Galaxy S7 SM-G930F. Released: March 2016. 43 | * https://www.amazon.com/Samsung-SM-G930F-Factory-Unlocked-Smartphone/dp/B01J6MS6BC 44 | * https://www.handsetdetection.com/properties/devices/Samsung/SM-G930F 45 | */ 46 | "23/6.0.1; 640dpi; 1440x2560; samsung; SM-G930F; herolte; samsungexynos8890" 47 | }; 48 | 49 | public static string getRandomGoodDevice() 50 | { 51 | return DEVICES[new Random().Next(0, 5)]; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/utils/Signatures.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Security.Cryptography; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace InstagramPrivateAPI.src.utils 9 | { 10 | internal class Signatures 11 | { 12 | public static Encoding UTF8E = Encoding.UTF8; 13 | 14 | public static string generateUUID(bool type) 15 | { 16 | if (type) 17 | return Guid.NewGuid().ToString("D"); 18 | else 19 | return Guid.NewGuid().ToString("D").Replace("-", ""); 20 | } 21 | 22 | public static string generateDeviceId(string source) 23 | { 24 | return "android-" + GetMd5Hash(MD5.Create(), GetMd5Hash(MD5.Create(), source) + "12345").Substring(0, 16); 25 | } 26 | 27 | public static string HMAC(string String, string Key) 28 | { 29 | var keyByte = UTF8E.GetBytes(Key); 30 | using (var hmacsha256 = new HMACSHA256(keyByte)) 31 | { 32 | hmacsha256.ComputeHash(UTF8E.GetBytes(String)); 33 | return ByteToString(hmacsha256.Hash).ToLower(); 34 | } 35 | } 36 | 37 | public static string ByteToString(byte[] buff) 38 | { 39 | string sbinary = ""; 40 | for (int i = 0; i < buff.Length; i++) 41 | sbinary += buff[i].ToString("X2"); 42 | return sbinary; 43 | } 44 | 45 | public static string EncodeUrl(string Url) 46 | { 47 | return Uri.EscapeDataString(Url); 48 | } 49 | 50 | static string GetMd5Hash(MD5 md5Hash, string input) 51 | { 52 | 53 | // Convert the input string to a byte array and compute the hash. 54 | byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input)); 55 | 56 | // Create a new Stringbuilder to collect the bytes 57 | // and create a string. 58 | StringBuilder sBuilder = new StringBuilder(); 59 | 60 | // Loop through each byte of the hashed data 61 | // and format each one as a hexadecimal string. 62 | for (int i = 0; i < data.Length; i++) 63 | { 64 | sBuilder.Append(data[i].ToString("x2")); 65 | } 66 | 67 | // Return the hexadecimal string. 68 | return sBuilder.ToString(); 69 | } 70 | } 71 | } 72 | --------------------------------------------------------------------------------