diff --git a/Changelog.md b/Changelog.md index da143f1..61500c1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,10 @@ +# 2022.6.10.0 + +**Attention! From now on, Instagram requires Cookies, Hash and authorization headers!** + +- Fixed + - Can't get Instagram user ID + # 2022.6.6.0 - Added diff --git a/README.md b/README.md index 8722871..70803bc 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ The program has an intuitive interface. You need to set up authorization for Twitter and Instagram: - Authorization [cookies](https://github.com/AAndyProgram/SCrawler/wiki/Settings#how-to-set-up-cookies) and [tokens](https://github.com/AAndyProgram/SCrawler/wiki/Settings#how-to-find-twitter-tokens) for **Twitter** (if you want to download data from Twitter) -- Authorization [cookies](https://github.com/AAndyProgram/SCrawler/wiki/Settings#how-to-set-up-cookies) and [Hash](https://github.com/AAndyProgram/SCrawler/wiki/Settings#instagram) for **Instagram** (if you want to download data from Instagram), [Hash 2](https://github.com/AAndyProgram/SCrawler/wiki/Settings#how-to-find-instagram-hash-2) for **saved Instagram posts**, Instagram [stories authorization headers](https://github.com/AAndyProgram/SCrawler/wiki/Settings#how-to-find-instagram-stories-authorization-headers) for **Stories** and **Tagged data** +- Authorization [cookies](https://github.com/AAndyProgram/SCrawler/wiki/Settings#how-to-set-up-cookies), [Hash](https://github.com/AAndyProgram/SCrawler/wiki/Settings#instagram) and [authorization headers](https://github.com/AAndyProgram/SCrawler/wiki/Settings#how-to-find-instagram-authorization-headers) for **Instagram** (if you want to download data from Instagram), [Hash 2](https://github.com/AAndyProgram/SCrawler/wiki/Settings#how-to-find-instagram-hash-2) for **saved Instagram posts** Just add a user profile and **click the ```Start downloading``` button**. diff --git a/SCrawler/API/Instagram/UserData.vb b/SCrawler/API/Instagram/UserData.vb index c4465bc..598bb60 100644 --- a/SCrawler/API/Instagram/UserData.vb +++ b/SCrawler/API/Instagram/UserData.vb @@ -536,7 +536,8 @@ Namespace API.Instagram End Try End Sub #End Region - Private Sub GetUserId() +#Region "GetUserId" + Private Sub GetUserId_Old() Try Dim r$ = Responser.GetResponse($"https://www.instagram.com/{Name}/?__a=1",, EDP.ThrowException) If Not r.IsEmptyString Then @@ -552,6 +553,23 @@ Namespace API.Instagram End If End Try End Sub + Private Sub GetUserId() + Try + Dim r$ = Responser.GetResponse($"https://i.instagram.com/api/v1/users/web_profile_info/?username={Name}",, EDP.ThrowException) + If Not r.IsEmptyString Then + Using j As EContainer = JsonDocument.Parse(r).XmlIfNothing + ID = j({"data", "user"}, "id").XmlIfNothingValue + End Using + End If + Catch ex As Exception + If Responser.StatusCode = HttpStatusCode.NotFound Or Responser.StatusCode = HttpStatusCode.BadRequest Then + Throw ex + Else + LogError(ex, "get Instagram user id") + End If + End Try + End Sub +#End Region #Region "Pinned stories" Private Sub GetStoriesData(ByRef StoriesList As List(Of String), ByVal Token As CancellationToken) Const ReqUrl$ = "https://i.instagram.com/api/v1/feed/reels_media/?{0}" diff --git a/SCrawler/API/Reddit/UserData.vb b/SCrawler/API/Reddit/UserData.vb index c58b1cc..43a30bd 100644 --- a/SCrawler/API/Reddit/UserData.vb +++ b/SCrawler/API/Reddit/UserData.vb @@ -730,7 +730,7 @@ Namespace API.Reddit ElseIf Responser.StatusCode = HttpStatusCode.BadGateway Or Responser.StatusCode = HttpStatusCode.ServiceUnavailable Or Responser.StatusCode = HttpStatusCode.GatewayTimeout Then - MyMainLOG = $"Reddit is currently unavailable ({ToString()})" + MyMainLOG = $"[{CInt(Responser.StatusCode)}] Reddit is currently unavailable ({ToString()})" Else If Not FromPE Then LogError(ex, Message) : HasError = True Return 0 diff --git a/SCrawler/My Project/AssemblyInfo.vb b/SCrawler/My Project/AssemblyInfo.vb index 3afa04b..28b0db7 100644 --- a/SCrawler/My Project/AssemblyInfo.vb +++ b/SCrawler/My Project/AssemblyInfo.vb @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - - + +