Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InstaMedia.Likers doesn't work #234

Open
wants to merge 155 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
68d6e44
myget pre-release packages
a-legotin Aug 20, 2017
cc3283b
standart 2.0 + package updates
a-legotin Aug 31, 2017
a8da297
Remove fallback version
a-legotin Aug 31, 2017
649b5ef
Send direct message implementation (#74)
lordofhammsters Oct 14, 2017
175e29f
send message improvements
a-legotin Oct 14, 2017
52ca32c
#75 get friendship status
a-legotin Oct 16, 2017
2d699d5
travis ci, dotnet 2.0
a-legotin Oct 16, 2017
47eb1c8
Removed framework version from travis
a-legotin Oct 16, 2017
c975c6a
netstandard2.0
a-legotin Oct 16, 2017
918ceff
Improved user info part of API
a-legotin Oct 20, 2017
a586a21
Merge branch 'develop' of https://github.com/a-legotin/InstaSharper i…
a-legotin Oct 20, 2017
e86bb26
Access modifiers and general code refactoring
a-legotin Oct 21, 2017
5c6ce7d
readme update
a-legotin Oct 21, 2017
8569765
Adjusted explore feed (no pagination)
a-legotin Oct 23, 2017
3e16124
Merge branch 'develop' of https://github.com/a-legotin/InstaSharper i…
a-legotin Oct 23, 2017
9a3f154
Clean up
a-legotin Oct 24, 2017
c1f1fdb
Code inspection corrections
a-legotin Oct 26, 2017
fbbbbe9
Added a better logging mechanism to reach more details. (#78)
n0ise9914 Oct 27, 2017
b88a246
Update appveyor.yml
a-legotin Oct 27, 2017
64c759d
Adjusted logger
a-legotin Oct 27, 2017
6cb1e94
Merge branch 'develop' of https://github.com/a-legotin/InstaSharper i…
a-legotin Oct 27, 2017
74ef280
More corrections to logger
a-legotin Oct 27, 2017
f439d14
GetTagFeedAsync»InstaMedia»InstaUserShort should be InstaUser (#80)
n0ise9914 Oct 28, 2017
a611dae
Explore feed add pagination
a-legotin Oct 28, 2017
024d1c2
Add user story feed
a-legotin Oct 28, 2017
b092696
Get story feed corrected
a-legotin Oct 28, 2017
bf69dbb
Save session data implemented
a-legotin Oct 28, 2017
c42720d
Change state saving to return stream
a-legotin Oct 28, 2017
d138c93
Added GetUserMediaAsync by user pk method. (#82)
n0ise9914 Oct 29, 2017
f2726ec
Revert "Added GetUserMediaAsync by user pk method. (#82)"
a-legotin Nov 2, 2017
340f87c
Added recent and ranked recipients
a-legotin Nov 5, 2017
ce926f0
Added massaging demo sample
a-legotin Nov 5, 2017
ead3092
Merge branch 'master' into develop
a-legotin Nov 5, 2017
e5067b7
Add story converter
a-legotin Nov 8, 2017
e81d857
Improved logging and exception handling
a-legotin Nov 14, 2017
9fbbc00
Update README.md
a-legotin Nov 14, 2017
d279fbf
Added docs, app key
a-legotin Nov 15, 2017
c1cd172
#83. #88, #94
a-legotin Nov 15, 2017
d8aae9c
Update README.md
a-legotin Nov 16, 2017
85d3300
Refactoring of converters, DTO classes set public, send message to un…
a-legotin Nov 16, 2017
739af08
Update README.md
a-legotin Nov 16, 2017
ee471a4
Update README.md
a-legotin Nov 16, 2017
8e2f552
#98, #99, fixes for converters
a-legotin Nov 17, 2017
08a5a6f
Merge branch 'develop' of https://github.com/a-legotin/InstaSharper i…
a-legotin Nov 17, 2017
344faea
#100, comparision of username corrected
a-legotin Nov 19, 2017
a8a9e57
2FA, Upload photos as album, Collection support (#102)
ADeltaX Nov 22, 2017
83b1513
Handling and creating share link (#104)
ADeltaX Nov 25, 2017
cf26c38
Fix https://github.com/a-legotin/InstaSharper/issues/97 (#107)
MelnikovIG Nov 28, 2017
3c8defb
Update README.md (#108)
KevinLamb Nov 29, 2017
a62de0b
Add edit collection
a-legotin Nov 29, 2017
7925cd0
Merge branch 'develop' of https://github.com/a-legotin/InstaSharper i…
a-legotin Nov 29, 2017
41e5586
Clean up
a-legotin Nov 29, 2017
6c50292
Added Block/Unblock User (#110)
vitalragaz Dec 5, 2017
ba1049c
#113 added support of link, media types in direct inbox message
a-legotin Dec 21, 2017
4d17b99
117, fixed
a-legotin Dec 22, 2017
52d0735
Added location search
a-legotin Dec 30, 2017
81b3f9a
Added location feed
a-legotin Jan 1, 2018
a2bb597
Move media related stuff to separate processor
a-legotin Jan 1, 2018
49402b7
Stuff moved to processors
a-legotin Jan 3, 2018
fa5c59c
Pagination added for followers/followings
a-legotin Jan 3, 2018
1d7cc97
Moved some more stuff to the separate processors
a-legotin Jan 3, 2018
288acbc
move remaining parts to processors
a-legotin Jan 4, 2018
bfbb040
Improvements to location feed
a-legotin Jan 4, 2018
105b3ea
Pagination improvements #106
a-legotin Jan 5, 2018
e8d7a21
Cleanup + feed corrections
a-legotin Jan 6, 2018
31575d4
Samples project improved
a-legotin Jan 6, 2018
e0aaf5a
Code cleanup, bump version, ci script
a-legotin Jan 6, 2018
9f01935
Readme upd
a-legotin Jan 6, 2018
b7b79f2
Support for videos in media posts, bug fixes in carousel and code cle…
Nanosync Jan 7, 2018
48f867a
readme update
a-legotin Jan 13, 2018
44d8bab
Added user extended info, by pk
a-legotin Jan 17, 2018
aedd2b8
Merge branch 'develop' of https://github.com/a-legotin/InstaSharper i…
a-legotin Jan 17, 2018
1f9a825
Fixed duplication of data in the RankedItems field (#129)
devigo Jan 19, 2018
28940a9
Adjusted return type a bit
a-legotin Jan 21, 2018
313ec52
Merge branch 'develop' of https://github.com/a-legotin/InstaSharper i…
a-legotin Jan 21, 2018
d4998fa
few results improvements
a-legotin Jan 22, 2018
957834a
Corrected processing of requests limit
a-legotin Jan 22, 2018
c52c30d
Comparers added
a-legotin Jan 27, 2018
4abf934
Log level adjusted
a-legotin Jan 27, 2018
f4107de
Small fixes and refactoring (#135)
devigo Jan 30, 2018
463035a
Added search for followers-following #139
a-legotin Feb 4, 2018
298680b
Merge branch 'develop' of https://github.com/a-legotin/InstaSharper i…
a-legotin Feb 4, 2018
5c58c11
Build fixed
a-legotin Feb 4, 2018
4eec24d
Added getting information about a user by username (#141)
devigo Feb 6, 2018
47a302e
Added a search for hashtags with a list of exclusions and getting has…
devigo Feb 7, 2018
8719500
readme upd
a-legotin Feb 23, 2018
ba444da
Corrected loading of followers
a-legotin Mar 2, 2018
4669a26
add interface implementation declaration (#170)
almarax Mar 8, 2018
86fd98f
simply return null of no stories (#169)
almarax Mar 8, 2018
a28097c
IsAuthenticated is false when logout successful (#168)
almarax Mar 10, 2018
28cff64
Added a RequestDelay object, in which you can set a random delay betw…
AlexanderLesnyakov Mar 10, 2018
35dbd80
Unix time stamp from millisec fix with fast check for arg length (#174)
almarax Mar 19, 2018
3019bd8
Added ability to disable / enable RequestDelay. (#171)
AlexanderLesnyakov Apr 2, 2018
7030dd7
Readme upd
a-legotin Apr 9, 2018
038b6f4
if logout failed, IsAuthenticated will not change. (#175)
lfahmi Apr 10, 2018
7551e93
Added IRequestDelay interface for more flexibility. (#178)
AlexanderLesnyakov Apr 15, 2018
4110d48
Video Upload & Account creation implemented (#177)
ramtinak Apr 15, 2018
f46b86d
Conditional csproj + add v.471 framework
a-legotin Apr 16, 2018
b853079
Added assets to the tests
a-legotin Apr 16, 2018
99a92d2
Added assets to the tests
a-legotin Apr 16, 2018
61fdd95
Merge remote-tracking branch 'origin/develop' into develop
a-legotin Apr 16, 2018
3aee3a8
remove telegram chat link
a-legotin Apr 25, 2018
bc10321
updated sig_key
a-legotin May 3, 2018
b4caa09
Added new user-agent
a-legotin May 9, 2018
d3d4327
Capabilities adjusted
a-legotin May 12, 2018
a104368
44.0 sig key
a-legotin Jun 15, 2018
0d8b56f
upd client string version
a-legotin Jun 18, 2018
7173f48
update dependencies + xUnit
a-legotin Jun 23, 2018
8366542
Add search users functionality
a-legotin Jun 26, 2018
f9401c5
Fix xUnit violation and test added
a-legotin Jun 29, 2018
1d3c1ac
Code cleanup
a-legotin Jul 1, 2018
cb21007
fix projects & update target framework to 4.7.2
a-legotin Jul 11, 2018
87f4237
correct access modifiers for few classes [skip ci]
a-legotin Jul 14, 2018
dcd0c95
Improved bad status handler
a-legotin Jul 15, 2018
384d2dd
Add message link poco class [skip ci]
a-legotin Jul 16, 2018
8c1f2ae
Add link message broadcast
a-legotin Jul 18, 2018
0476e17
Add link message send [skip ci]
a-legotin Jul 20, 2018
2e538a6
Add test for link message
a-legotin Jul 22, 2018
7fd446c
More improvement fo rbad status parsing
a-legotin Aug 5, 2018
5047b41
Http helper & result adjusted
a-legotin Aug 7, 2018
4fcc7f9
Fixed direct link broadcast
a-legotin Aug 10, 2018
6fc33c9
Tests for messaging added
a-legotin Aug 12, 2018
076eb8c
Add missing await
a-legotin Aug 13, 2018
3d1dd5b
Add constants for media share
a-legotin Aug 16, 2018
50d0488
Add media share through direct message
a-legotin Aug 20, 2018
64d379a
Add tests for media share
a-legotin Aug 20, 2018
6d59a1e
Result info improved to include raw response
a-legotin Aug 22, 2018
630f3a2
Adjusted create account function
a-legotin Aug 25, 2018
67dea02
Add uri for decline/approve threads
a-legotin Aug 27, 2018
f4460c7
Add decline all threads
a-legotin Aug 27, 2018
66dc68c
Add test for decline all threads
a-legotin Aug 28, 2018
bee056c
Add approve thread function
a-legotin Sep 2, 2018
2bb6c93
Added test for approve thread
a-legotin Sep 6, 2018
482ff72
Comments added for API
a-legotin Sep 10, 2018
1ade5e7
Update issue templates
a-legotin Sep 12, 2018
501e75d
Update issue templates #2
a-legotin Sep 12, 2018
c09b0ef
Update ReadME (#179)
ramtinak Sep 13, 2018
acab74f
Update issue templates #3
a-legotin Sep 13, 2018
7ae42e6
implemented challenge resolving (#194)
n0ise9914 Sep 26, 2018
0966cce
I've added a few useful lines (#202)
n0ise9914 Oct 6, 2018
a24a97f
Fixed bug with time in recent activities (#220)
AntonZelinsky Jan 31, 2019
aa825bc
Added clarify activity feed type (#221)
AntonZelinsky Feb 10, 2019
4af3cb7
Fix: GetTimeline posts and get current user following (#225)
Aug 15, 2019
09e8335
Added last seen details in direct inbox thread (#226)
Abbas-b-b Aug 20, 2019
7f2f490
Update app version
a-legotin Sep 10, 2019
e0ca6c2
Fix Converting ClientContext To Guid Err (#229)
ashalogic Oct 18, 2019
99e30e8
fix a bug when UploadPhotosAlbum method returns an empty instance of …
q2een Oct 21, 2019
ddec14f
fixed typo and references (#233)
FriedrichRehren Jan 24, 2020
64164de
Upgra to 2.1
a-legotin Jan 25, 2020
410ed97
update build scripts
a-legotin Jan 25, 2020
5a05297
Fix travis build
a-legotin Jan 25, 2020
6cd2f92
change travis dist to bionic
a-legotin Jan 26, 2020
75c562f
change build framework to 2.1
a-legotin Jan 26, 2020
aedcbbe
typo: folling -> following (#235)
NoNamePro0 Nov 29, 2020
ebb2f7e
add & before max_id in GetUserTagsUri method (#236)
hosseinRezaei188 May 12, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Bug report
about: Create a report to help us improve

---

**Before creating issue**
Put `x` marks below to validate what you've done before posting issue.

[ ] I've checked [FAQ](https://github.com/a-legotin/InstaSharper/wiki/FAQ)
[ ] I've checked [wiki page](https://github.com/a-legotin/InstaSharper/wiki)
[ ] I've examined [examples project](https://github.com/a-legotin/InstaSharper/tree/develop/InstaSharper.Examples)
[ ] I've did search [existing issues](https://github.com/a-legotin/InstaSharper/issues) for similar problems
[ ] I've understand that issue will be closed and locked if issue related to `checkpoint, challenge, feedback required` or `sentry_block` or `signup_block`- see [FAQ](https://github.com/a-legotin/InstaSharper/wiki/FAQ)

## Be warned - issue will be closed if none from above is done before posting issue.

**Describe the issue**
A clear and concise description of what the issue is.
Attach logs ([How to use logger to get logs](https://github.com/a-legotin/InstaSharper/blob/develop/InstaSharper.Examples/Program.cs)).
Provide state of [Info](https://github.com/a-legotin/InstaSharper/blob/develop/InstaSharper/Classes/ResultInfo.cs) property when you got [IResult response](https://github.com/a-legotin/InstaSharper/blob/develop/InstaSharper/Classes/Result.cs).

**To Reproduce**
How can I reproduce the problem:
1. Attach code snippet
2. Push sample project to github and add link here.
3. What actions is causing issue.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Target (please complete the following information):**
- Platform: [e.g. Windows, Linux]
- Target framework [e.g. netstandard, net452]
- Version [e.g. 1.4.50]

Add any other context about the problem here.
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Question
about: Describe question here

---

**Before creating issue**
Put `x` marks below to validate what you've done before posting issue.

[ ] I've checked [FAQ](https://github.com/a-legotin/InstaSharper/wiki/FAQ)
[ ] I've checked [wiki page](https://github.com/a-legotin/InstaSharper/wiki)
[ ] I've examined [examples project](https://github.com/a-legotin/InstaSharper/tree/develop/InstaSharper.Examples)
[ ] I've did search [existing issues](https://github.com/a-legotin/InstaSharper/issues) for similar problems
[ ] I've understand that issue will be closed and locked if issue related to `checkpoint, challenge, feedback required` or `sentry_block` or `signup_block`- see [FAQ](https://github.com/a-legotin/InstaSharper/wiki/FAQ)

## Be warned - issue will be closed if none from above is done before posting issue.

**Describe the issue**
A clear and concise description of your question

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Target (please complete the following information):**
- Platform: [e.g. Windows, Linux]
- Target framework [e.g. netstandard, net452]
- Version [e.g. 1.4.50]

Add any other context about the problem here.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -262,4 +262,8 @@ paket-files/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
*.pyc

# binary files and texts notes
**/*.bin
**/*.txt
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
language: csharp
dist: trusty
dist: bionic
language: csharp
mono: none
dotnet: 2.0.0
dotnet: 3.0.1
solution: InstaSharper.sln

script:
- cd InstaSharper
- dotnet --info
- dotnet restore
- dotnet build --framework netstandard2.0
- dotnet build --framework netstandard2.1
12 changes: 8 additions & 4 deletions InstaSharper.Examples/InstaSharper.Examples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="InstaSharper, Version=1.2.6.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\InstaSharper\bin\release\net452\InstaSharper.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
Expand All @@ -52,10 +48,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Samples\Basics.cs" />
<Compile Include="Samples\CollectionSample.cs" />
<Compile Include="Samples\CommentMedia.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Samples\IDemoSample.cs" />
<Compile Include="Samples\LocationSample.cs" />
<Compile Include="Samples\Messaging.cs" />
<Compile Include="Samples\SaveLoadState.cs" />
<Compile Include="Samples\Stories.cs" />
Expand All @@ -67,6 +65,12 @@
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\InstaSharper\InstaSharper.csproj">
<Project>{dada2751-e331-4231-9434-7141b6b2fe79}</Project>
<Name>InstaSharper</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
13 changes: 11 additions & 2 deletions InstaSharper.Examples/InstaSharper.Examples.sln
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2024
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstaSharper.Examples", "InstaSharper.Examples.csproj", "{620D3DB5-5636-4A54-A7D7-600C6518C20E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InstaSharper", "..\InstaSharper\InstaSharper.csproj", "{DADA2751-E331-4231-9434-7141B6B2FE79}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,8 +17,15 @@ Global
{620D3DB5-5636-4A54-A7D7-600C6518C20E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{620D3DB5-5636-4A54-A7D7-600C6518C20E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{620D3DB5-5636-4A54-A7D7-600C6518C20E}.Release|Any CPU.Build.0 = Release|Any CPU
{DADA2751-E331-4231-9434-7141B6B2FE79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DADA2751-E331-4231-9434-7141B6B2FE79}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DADA2751-E331-4231-9434-7141B6B2FE79}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DADA2751-E331-4231-9434-7141B6B2FE79}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {70B2DB74-9F1A-453F-95B0-9942F90FAAE0}
EndGlobalSection
EndGlobal
115 changes: 78 additions & 37 deletions InstaSharper.Examples/Program.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using InstaSharper.API;
using InstaSharper.API.Builder;
using InstaSharper.Classes;
using InstaSharper.Classes.Android.DeviceInfo;
using InstaSharper.Examples.Samples;
using InstaSharper.Logger;

Expand Down Expand Up @@ -37,58 +37,99 @@ public static async Task<bool> MainAsync()
Password = "password"
};

var delay = RequestDelay.FromSeconds(2, 2);
// create new InstaApi instance using Builder
var device = AndroidDeviceGenerator.GetByName(AndroidDevices.SAMSUNG_NOTE3);
var requestMessage = ApiRequestMessage.FromDevice(device);
_instaApi = InstaApiBuilder.CreateBuilder()
.SetUser(userSession)
.SetApiRequestMessage(requestMessage)
.UseLogger(new DebugLogger(LogLevel.Info)) // use logger for requests and debug messages
.SetRequestDelay(TimeSpan.FromSeconds(2))
.Build();
// login
Console.WriteLine($"Logging in as {userSession.UserName}");
var logInResult = await _instaApi.LoginAsync();
if (!logInResult.Succeeded)
.UseLogger(new DebugLogger(LogLevel.Exceptions)) // use logger for requests and debug messages
.SetRequestDelay(delay)
.Build();
//// create account
//var username = "kajokoleha";
//var password = "ramtinjokar";
//var email = "[email protected]";
//var firstName = "Ramtin";
//var accountCreation = await _instaApi.CreateNewAccount(username, password, email, firstName);

const string stateFile = "state.bin";
try
{
Console.WriteLine($"Unable to login: {logInResult.Info.Message}");
if (File.Exists(stateFile))
{
Console.WriteLine("Loading state from file");
using (var fs = File.OpenRead(stateFile))
{
_instaApi.LoadStateDataFromStream(fs);
}
}
}
else
catch (Exception e)
{
Console.WriteLine("Press 1 to start basic demo samples");
Console.WriteLine("Press 2 to start upload photo demo sample");
Console.WriteLine("Press 3 to start comment media demo sample");
Console.WriteLine("Press 4 to start stories demo sample");
Console.WriteLine("Press 5 to start demo with saving state of API instance");
Console.WriteLine("Press 6 to start messaging demo sample");
Console.WriteLine(e);
}

var samplesMap = new Dictionary<ConsoleKey, IDemoSample>
if (!_instaApi.IsUserAuthenticated)
{
// login
Console.WriteLine($"Logging in as {userSession.UserName}");
delay.Disable();
var logInResult = await _instaApi.LoginAsync();
delay.Enable();
if (!logInResult.Succeeded)
{
[ConsoleKey.D1] = new Basics(_instaApi),
[ConsoleKey.D2] = new UploadPhoto(_instaApi),
[ConsoleKey.D3] = new CommentMedia(_instaApi),
[ConsoleKey.D4] = new Stories(_instaApi),
[ConsoleKey.D5] = new SaveLoadState(_instaApi),
[ConsoleKey.D6] = new Messaging(_instaApi)
};
var key = Console.ReadKey();
Console.WriteLine(Environment.NewLine);
if (samplesMap.ContainsKey(key.Key))
await samplesMap[key.Key].DoShow();
Console.WriteLine("Done. Press esc key to exit...");

key = Console.ReadKey();
return key.Key == ConsoleKey.Escape;
Console.WriteLine($"Unable to login: {logInResult.Info.Message}");
return false;
}
}
var state = _instaApi.GetStateDataAsStream();
using (var fileStream = File.Create(stateFile))
{
state.Seek(0, SeekOrigin.Begin);
state.CopyTo(fileStream);
}

Console.WriteLine("Press 1 to start basic demo samples");
Console.WriteLine("Press 2 to start upload photo demo sample");
Console.WriteLine("Press 3 to start comment media demo sample");
Console.WriteLine("Press 4 to start stories demo sample");
Console.WriteLine("Press 5 to start demo with saving state of API instance");
Console.WriteLine("Press 6 to start messaging demo sample");
Console.WriteLine("Press 7 to start location demo sample");
Console.WriteLine("Press 8 to start collections demo sample");
Console.WriteLine("Press 9 to start upload video demo sample");

var samplesMap = new Dictionary<ConsoleKey, IDemoSample>
{
[ConsoleKey.D1] = new Basics(_instaApi),
[ConsoleKey.D2] = new UploadPhoto(_instaApi),
[ConsoleKey.D3] = new CommentMedia(_instaApi),
[ConsoleKey.D4] = new Stories(_instaApi),
[ConsoleKey.D5] = new SaveLoadState(_instaApi),
[ConsoleKey.D6] = new Messaging(_instaApi),
[ConsoleKey.D7] = new LocationSample(_instaApi),
[ConsoleKey.D8] = new CollectionSample(_instaApi),
[ConsoleKey.D9] = new UploadVideo(_instaApi)


};
var key = Console.ReadKey();
Console.WriteLine(Environment.NewLine);
if (samplesMap.ContainsKey(key.Key))
await samplesMap[key.Key].DoShow();
Console.WriteLine("Done. Press esc key to exit...");

key = Console.ReadKey();
return key.Key == ConsoleKey.Escape;
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
finally
{
var logoutResult = Task.Run(() => _instaApi.LogoutAsync()).GetAwaiter().GetResult();
if (logoutResult.Succeeded) Console.WriteLine("Logout succeed");
// perform that if user needs to logged out
// var logoutResult = Task.Run(() => _instaApi.LogoutAsync()).GetAwaiter().GetResult();
// if (logoutResult.Succeeded) Console.WriteLine("Logout succeed");
}
return false;
}
Expand Down
22 changes: 13 additions & 9 deletions InstaSharper.Examples/Samples/Basics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Linq;
using System.Threading.Tasks;
using InstaSharper.API;
using InstaSharper.Classes;
using InstaSharper.Examples.Utils;

namespace InstaSharper.Examples.Samples
Expand All @@ -27,16 +28,19 @@ public async Task DoShow()
Console.WriteLine(
$"Logged in: username - {currentUser.Value.UserName}, full name - {currentUser.Value.FullName}");

// get self followers
var followers = await _instaApi.GetUserFollowersAsync(currentUser.Value.UserName, 5);
Console.WriteLine($"Count of followers [{currentUser.Value.UserName}]:{followers.Value.Count}");
// get followers of user 'elonmusk'
var followers = await _instaApi.GetUserFollowersAsync("elonmusk",
PaginationParameters.MaxPagesToLoad(5)
.StartFromId("AQAC8w90POWyM7zMjHWmO9vsZNL_TuLp6FR506_C_y3fUAjlCclrIDI2RdSGvur5UjLrq4Cq7NJN8QUhHG-vpbT6pCLB5X9crDxBOHUEuNJ4fA"));
Console.WriteLine($"Count of followers [elonmusk]:{followers.Value.Count}");
Console.WriteLine($"Next id will be: '{followers.Value.NextId}'");

// get self folling
var following = await _instaApi.GetUserFollowingAsync(currentUser.Value.UserName, 5);
// get self following
var following = await _instaApi.GetUserFollowingAsync(currentUser.Value.UserName, PaginationParameters.MaxPagesToLoad(5));
Console.WriteLine($"Count of following [{currentUser.Value.UserName}]:{following.Value.Count}");

// get self user's media, latest 5 pages
var currentUserMedia = await _instaApi.GetUserMediaAsync(currentUser.Value.UserName, 5);
var currentUserMedia = await _instaApi.GetUserMediaAsync(currentUser.Value.UserName, PaginationParameters.MaxPagesToLoad(5));
if (currentUserMedia.Succeeded)
{
Console.WriteLine($"Media count [{currentUser.Value.UserName}]: {currentUserMedia.Value.Count}");
Expand All @@ -45,7 +49,7 @@ public async Task DoShow()
}

//get user time line feed, latest 5 pages
var userFeed = await _instaApi.GetUserTimelineFeedAsync(5);
var userFeed = await _instaApi.GetUserTimelineFeedAsync(PaginationParameters.MaxPagesToLoad(5));
if (userFeed.Succeeded)
{
Console.WriteLine(
Expand All @@ -62,7 +66,7 @@ public async Task DoShow()
}

// get tag feed, latest 5 pages
var tagFeed = await _instaApi.GetTagFeedAsync("quadcopter", 5);
var tagFeed = await _instaApi.GetTagFeedAsync("quadcopter", PaginationParameters.MaxPagesToLoad(5));
if (tagFeed.Succeeded)
{
Console.WriteLine(
Expand All @@ -72,4 +76,4 @@ public async Task DoShow()
}
}
}
}
}
Loading