Skip to content

Commit 0594e77

Browse files
committed
3.0.0.8
Script mode command Disabled Instagram error 403 Fixed script does not run
1 parent a5fa935 commit 0594e77

13 files changed

Lines changed: 69 additions & 73 deletions

Changelog.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
# 3.0.0.8
2+
3+
- Added
4+
- Script mode ```command```
5+
- Disabled Instagram error 403 (Forbidden) logging for downloading tagged data
6+
- Fixed
7+
- The script does not run after the user download is complete
8+
19
# 3.0.0.7
210

311
- Added
4-
- Ability to run a script after the user download if complete
12+
- Ability to run a script after the user download is complete
513
- Hotkey ```F2``` for additional options in the user creation form
614
- Fixed
715
- (Issue #32) In some cases, Date and Time are still not added for Stories and Tagged Photos
-107 Bytes
Loading

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Social networks crawler
22

33
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/AAndyProgram/SCrawler)](https://github.com/AAndyProgram/SCrawler/releases/latest)
4-
[![GitHub](https://img.shields.io/github/license/AAndyProgram/SCrawler)](https://github.com/AAndyProgram/SCrawler/)
4+
[![GitHub license](https://img.shields.io/github/license/AAndyProgram/SCrawler)](https://github.com/AAndyProgram/SCrawler/blob/main/LICENSE)
55
[![FAQ](https://img.shields.io/badge/FAQ-green)](FAQ.md)
66
[![GUIDE](https://img.shields.io/badge/GUIDE-green)](https://github.com/AAndyProgram/SCrawler/wiki)
77
[![How to support](https://img.shields.io/badge/HowToSupport-green)](HowToSupport.md)

SCrawler/API/Base/UserDataBase.vb

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Namespace API.Base
117117
Private Const Name_LastUpdated As String = "LastUpdated"
118118

119119
Private Const Name_ScriptUse As String = "ScriptUse"
120-
Private Const Name_ScriptFile As String = "ScriptFile"
120+
Private Const Name_ScriptData As String = "ScriptData"
121121

122122
Private Const Name_DataMerging As String = "DataMerging"
123123
#Region "Downloaded data"
@@ -411,7 +411,7 @@ BlockNullPicture:
411411
#End Region
412412
#Region "Script"
413413
Friend Overridable Property ScriptUse As Boolean = False Implements IUserData.ScriptUse
414-
Friend Overridable Property ScriptFile As SFile Implements IUserData.ScriptFile
414+
Friend Overridable Property ScriptData As String Implements IUserData.ScriptData
415415
#End Region
416416
#End Region
417417
#Region "Plugins Support"
@@ -585,16 +585,7 @@ BlockNullPicture:
585585
DownloadedPictures(True) = x.Value(Name_PicturesCount).FromXML(Of Integer)(0)
586586
LastUpdated = AConvert(Of Date)(x.Value(Name_LastUpdated), ADateTime.Formats.BaseDateTime, Nothing)
587587
ScriptUse = x.Value(Name_ScriptUse).FromXML(Of Boolean)(False)
588-
Dim s$ = x.Value(Name_ScriptFile)
589-
If Not s.IsEmptyString Then
590-
If SFile.IsDirectory(s) Then
591-
ScriptFile = s
592-
Else
593-
ScriptFile = New SFile(s) With {.Path = MyFile.Path}
594-
End If
595-
Else
596-
ScriptFile = Nothing
597-
End If
588+
ScriptData = x.Value(Name_ScriptData)
598589
DataMerging = x.Value(Name_DataMerging).FromXML(Of Boolean)(False)
599590
ChangeCollectionName(x.Value(Name_CollectionName), False)
600591
Labels.ListAddList(x.Value(Name_LabelsName).StringToList(Of String, List(Of String))("|", EDP.ReturnValue), LAP.NotContainsOnly, LAP.ClearBeforeAdd)
@@ -635,15 +626,7 @@ BlockNullPicture:
635626
x.Add(Name_PicturesCount, DownloadedPictures(True))
636627
x.Add(Name_LastUpdated, AConvert(Of String)(LastUpdated, ADateTime.Formats.BaseDateTime, String.Empty))
637628
x.Add(Name_ScriptUse, ScriptUse.BoolToInteger)
638-
If Not ScriptFile.IsEmptyString Then
639-
If ScriptFile.Path = MyFile.Path Then
640-
x.Add(Name_ScriptFile, ScriptFile.File)
641-
Else
642-
x.Add(Name_ScriptFile, ScriptFile)
643-
End If
644-
Else
645-
x.Add(Name_ScriptFile, String.Empty)
646-
End If
629+
x.Add(Name_ScriptData, ScriptData)
647630
x.Add(Name_CollectionName, CollectionName)
648631
x.Add(Name_LabelsName, Labels.ListToString(, "|", EDP.ReturnValue))
649632
x.Add(Name_DataMerging, DataMerging.BoolToInteger)
@@ -964,17 +947,18 @@ BlockNullPicture:
964947
End Function
965948
Private Sub RunScript()
966949
Try
950+
Const spa$ = "{0}"
967951
If ScriptUse Then
968952
Dim ScriptPattern$
969-
If Not ScriptFile.IsEmptyString Then
970-
ScriptPattern = ScriptFile
953+
If Not ScriptData.IsEmptyString Then
954+
ScriptPattern = ScriptData
971955
Else
972-
ScriptPattern = Settings.ScriptFile.Value
956+
ScriptPattern = Settings.ScriptData.Value
973957
End If
974958
If Not ScriptPattern.IsEmptyString Then
975-
ScriptPattern &= " {0}"
959+
If Not ScriptPattern.Contains(spa) Then ScriptPattern &= $" ""{spa}"""
976960
Using b As New BatchExecutor With {.RedirectStandardError = True}
977-
b.Execute({String.Format(ScriptPattern, MyFile.CutPath(1).ToString)}, EDP.SendInLog + EDP.ThrowException)
961+
b.Execute({String.Format(ScriptPattern, MyFile.CutPath(1).PathNoSeparator)}, EDP.SendInLog + EDP.ThrowException)
978962
If b.HasError Or Not b.ErrorOutput.IsEmptyString Then Throw New Exception(b.ErrorOutput, b.ErrorException)
979963
End Using
980964
End If
@@ -1035,11 +1019,8 @@ BlockNullPicture:
10351019
End If
10361020
f.CutPath.Exists(SFO.Path)
10371021
Directory.Move(UserBefore.File.CutPath(, EDP.ThrowException).Path, f.Path)
1038-
If Not ScriptFile.IsEmptyString AndAlso ScriptFile.Path = UserBefore.File.Path Then
1039-
Dim ff As SFile = ScriptFile
1040-
f.Path = MyFile.Path
1041-
ScriptFile = ff
1042-
End If
1022+
If Not ScriptData.IsEmptyString AndAlso ScriptData.Contains(UserBefore.File.PathNoSeparator) Then _
1023+
ScriptData = ScriptData.Replace(UserBefore.File.PathNoSeparator, MyFile.PathNoSeparator)
10431024
Settings.UsersList.Remove(UserBefore)
10441025
Settings.UpdateUsersList(User)
10451026
UpdateUserInformation()
@@ -1093,11 +1074,8 @@ BlockNullPicture:
10931074
New ErrorsDescriber(False, False, False, New List(Of SFile))).Count = 0 Then
10941075
UserBefore.File.CutPath.Delete(SFO.Path, Settings.DeleteMode, EDP.SendInLog)
10951076
End If
1096-
If Not ScriptFile.IsEmptyString AndAlso ScriptFile.Path = UserBefore.File.Path Then
1097-
Dim f As SFile = ScriptFile
1098-
f.Path = MyFile.Path
1099-
ScriptFile = f
1100-
End If
1077+
If Not ScriptData.IsEmptyString AndAlso ScriptData.Contains(UserBefore.File.PathNoSeparator) Then _
1078+
ScriptData = ScriptData.Replace(UserBefore.File.PathNoSeparator, MyFile.PathNoSeparator)
11011079
UpdateUserInformation()
11021080
End If
11031081
Catch ioex As InvalidOperationException When ioex.HelpLink = 1
@@ -1263,7 +1241,7 @@ BlockNullPicture:
12631241
Property DownloadImages As Boolean
12641242
Property DownloadVideos As Boolean
12651243
Property ScriptUse As Boolean
1266-
Property ScriptFile As SFile
1244+
Property ScriptData As String
12671245
Function GetLVI(ByVal Destination As ListView) As ListViewItem
12681246
Function GetLVIGroup(ByVal Destination As ListView) As ListViewGroup
12691247
Sub LoadUserInformation()

SCrawler/API/Instagram/UserData.vb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ Namespace API.Instagram
299299
Catch dex As ObjectDisposedException When Disposed
300300
Exit Do
301301
Catch ex As Exception
302-
If DownloadingException(ex, $"data downloading error [{URL}]") = 1 Then Continue Do Else Exit Do
302+
If DownloadingException(ex, $"data downloading error [{URL}]", Section, False) = 1 Then Continue Do Else Exit Do
303303
End Try
304304
Loop
305305
Catch eex2 As ExitException
@@ -538,7 +538,7 @@ Namespace API.Instagram
538538
End If
539539
Return Nothing
540540
Catch ex As Exception
541-
DownloadingException(ex, "API.Instagram.GetStoriesList")
541+
DownloadingException(ex, "API.Instagram.GetStoriesList", Sections.Stories, False)
542542
Return Nothing
543543
End Try
544544
End Function
@@ -552,13 +552,18 @@ Namespace API.Instagram
552552
''' <inheritdoc cref="UserDataBase.DownloadingException(Exception, String)"/><br/>
553553
''' 1 - continue
554554
''' </summary>
555-
Protected Overrides Function DownloadingException(ByVal ex As Exception, ByVal Message As String, Optional ByVal FromPE As Boolean = False) As Integer
555+
Protected Overloads Overrides Function DownloadingException(ByVal ex As Exception, ByVal Message As String, Optional ByVal FromPE As Boolean = False) As Integer
556+
Return DownloadingException(ex, Message, Sections.Timeline, FromPE)
557+
End Function
558+
Private Overloads Function DownloadingException(ByVal ex As Exception, ByVal Message As String, ByVal s As Sections, ByVal FromPE As Boolean) As Integer
556559
If Responser.StatusCode = HttpStatusCode.NotFound Then
557560
UserExists = False
558561
ElseIf Responser.StatusCode = HttpStatusCode.BadRequest Then
559562
HasError = True
560563
MyMainLOG = "Instagram credentials have expired"
561564
MySiteSettings.HashUpdateRequired.Value = True
565+
ElseIf Responser.StatusCode = HttpStatusCode.Forbidden And s = Sections.Tagged Then
566+
Return 3
562567
ElseIf Responser.StatusCode = 429 Then
563568
With MySiteSettings
564569
Dim WaiterExists As Boolean = .LastApplyingValue.HasValue

SCrawler/Editors/GlobalSettingsForm.Designer.vb

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SCrawler/Editors/GlobalSettingsForm.vb

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ Namespace Editors
3636
TXT_FOLDER_CMD.Text = .OpenFolderInOtherProgram
3737
TXT_FOLDER_CMD.Checked = .OpenFolderInOtherProgram.Attribute
3838
CH_RECYCLE_DEL.Checked = .DeleteToRecycleBin
39-
TXT_SCRIPT.Checked = .ScriptFile.Attribute
40-
TXT_SCRIPT.Text = .ScriptFile.Value
39+
TXT_SCRIPT.Checked = .ScriptData.Attribute
40+
TXT_SCRIPT.Text = .ScriptData.Value
4141
'Defaults
4242
CH_SEPARATE_VIDEO_FOLDER.Checked = .SeparateVideoFolder.Value
4343
CH_DEF_TEMP.Checked = .DefaultTemporary
@@ -125,8 +125,8 @@ Namespace Editors
125125
.OpenFolderInOtherProgram.Value = TXT_FOLDER_CMD.Text
126126
.OpenFolderInOtherProgram.Attribute.Value = TXT_FOLDER_CMD.Checked
127127
.DeleteToRecycleBin.Value = CH_RECYCLE_DEL.Checked
128-
.ScriptFile.Value = TXT_SCRIPT.Text
129-
.ScriptFile.Attribute.Value = TXT_SCRIPT.Checked
128+
.ScriptData.Value = TXT_SCRIPT.Text
129+
.ScriptData.Attribute.Value = TXT_SCRIPT.Checked
130130
'Defaults
131131
.SeparateVideoFolder.Value = CH_SEPARATE_VIDEO_FOLDER.Checked
132132
.DefaultTemporary.Value = CH_DEF_TEMP.Checked
@@ -200,10 +200,7 @@ Namespace Editors
200200
ChangePositionControlsEnabling()
201201
End Sub
202202
Private Sub TXT_SCRIPT_ActionOnButtonClick(ByVal Sender As ActionButton) Handles TXT_SCRIPT.ActionOnButtonClick
203-
If Sender.DefaultButton = ActionButton.DefaultButtons.Open Then
204-
Dim f As SFile = SFile.SelectFiles(TXT_SCRIPT.Text, False, "Select script file",, EDP.None).FirstOrDefault
205-
If Not f.IsEmptyString Then TXT_SCRIPT.Text = f
206-
End If
203+
SettingsCLS.ScriptTextBoxButtonClick(TXT_SCRIPT, Sender)
207204
End Sub
208205
Private Sub CH_COPY_CHANNEL_USER_IMAGE_CheckedChanged(sender As Object, e As EventArgs) Handles CH_COPY_CHANNEL_USER_IMAGE.CheckedChanged
209206
CH_COPY_CHANNEL_USER_IMAGE_ALL.Enabled = CH_COPY_CHANNEL_USER_IMAGE.Checked

SCrawler/Editors/UserCreatorForm.Designer.vb

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SCrawler/Editors/UserCreatorForm.vb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Imports SCrawler.Plugin.Hosts
1818
Imports ADB = PersonalUtilities.Forms.Controls.Base.ActionButton.DefaultButtons
1919
Namespace Editors
2020
Friend Class UserCreatorForm : Implements IOkCancelToolbar
21+
2122
Private ReadOnly MyDef As DefaultFormProps(Of FieldsChecker)
2223
Friend Property User As UserInfo
2324
Friend Property UserInstance As IUserData
@@ -71,7 +72,7 @@ Namespace Editors
7172
Return TXT_SCRIPT.Checked
7273
End Get
7374
End Property
74-
Friend ReadOnly Property ScriptFile As SFile
75+
Friend ReadOnly Property ScriptData As String
7576
Get
7677
Return TXT_SCRIPT.Text
7778
End Get
@@ -122,7 +123,7 @@ Namespace Editors
122123
CH_TEMP.Checked = Settings.DefaultTemporary
123124
CH_DOWN_IMAGES.Checked = Settings.DefaultDownloadImages
124125
CH_DOWN_VIDEOS.Checked = Settings.DefaultDownloadVideos
125-
TXT_SCRIPT.Checked = Settings.ScriptFile.Attribute
126+
TXT_SCRIPT.Checked = Settings.ScriptData.Attribute
126127
SetParamsBySite()
127128
Else
128129
TP_ADD_BY_LIST.Enabled = False
@@ -148,7 +149,7 @@ Namespace Editors
148149
CH_DOWN_IMAGES.Checked = .DownloadImages
149150
CH_DOWN_VIDEOS.Checked = .DownloadVideos
150151
TXT_SCRIPT.Checked = .ScriptUse
151-
TXT_SCRIPT.Text = .ScriptFile
152+
TXT_SCRIPT.Text = .ScriptData
152153
TXT_DESCR.Text = .Description
153154
UserLabels.ListAddList(.Labels)
154155
If UserLabels.ListExists Then TXT_LABELS.Text = UserLabels.ListToString
@@ -237,7 +238,7 @@ Namespace Editors
237238
End If
238239
.ParseUserMediaOnly = CH_PARSE_USER_MEDIA.Checked
239240
.ScriptUse = TXT_SCRIPT.Checked
240-
.ScriptFile = TXT_SCRIPT.Text
241+
.ScriptData = TXT_SCRIPT.Text
241242
.UpdateUserInformation()
242243
End With
243244
End If
@@ -488,10 +489,7 @@ CloseForm:
488489
End Using
489490
End Sub
490491
Private Sub TXT_SCRIPT_ActionOnButtonClick(ByVal Sender As ActionButton) Handles TXT_SCRIPT.ActionOnButtonClick
491-
If Sender.DefaultButton = ADB.Open Then
492-
Dim f As SFile = SFile.SelectFiles(TXT_SCRIPT.Text, False, "Select script file").FirstOrDefault
493-
If Not f.IsEmptyString Then TXT_SCRIPT.Text = f
494-
End If
492+
SettingsCLS.ScriptTextBoxButtonClick(TXT_SCRIPT, Sender)
495493
End Sub
496494
End Class
497495
End Namespace

0 commit comments

Comments
 (0)