Update to v1.2.0.1

This commit is contained in:
Richard Mwewa
2023-02-19 05:36:28 +02:00
committed by GitHub
parent d9d0e58759
commit 2d79877440
12 changed files with 1362 additions and 575 deletions

View File

@@ -4,11 +4,9 @@ Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Public Class ApiHandler
'Public currentDateTime As DateTime = DateTime.Now
'ReadOnly formattedDateTime As String = String.Format("{0:yyyy_MM_dd_HH_mm}", currentDateTime)
Public logfile As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RedditPostScrapingTool", "logs", $"debug.log")
Public headers As String = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15"
Public UpdatesEndpoint As String = "https://api.github.com/repos/rly0nheart/reddit-post-scraping-tool/releases/latest"
Public UpdatesEndpoint As String = "https://api.github.com/repos/bellingcat/reddit-post-scraping-tool/releases/latest"
Public Function ScrapeReddit(subreddit, listing, limit, timeframe) As JObject
Dim ApiEndpoint As String = $"https://reddit.com/r/{subreddit}/{listing}.json?limit={limit}&t={timeframe}').json()"
@@ -37,7 +35,7 @@ Public Class ApiHandler
End Function
' Get remote version information from the repository release page
' Gets remote version information from the repository release page
Public Function CheckUpdates() As JObject
Try
Dim httpClient As New HttpClient()

View File

@@ -73,6 +73,7 @@ Partial Class DeveloperForm
Me.Name = "DeveloperForm"
Me.ShowIcon = False
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
Me.Text = "Developer"
Me.ResumeLayout(False)
Me.PerformLayout()

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2022 Richard Mwewa
Copyright (c) 2023 Richard Mwewa
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -9,11 +9,11 @@ Given a subreddit name and a keyword, this script will return all posts from a s
# Features (GUI)
- [x] Auto dark mode from 6pm - 6am
- [x] Saves results to a JSON
- [x] Other features coming soon...
- [ ] Other features coming soon...
# TODO (GUI)
- [x] Make it a stand alone executable
- [x] Add comments to the code 😆
- [ ] Make it a stand alone executable
- [ ] Add manual dark mode option, that will be remembered in all sessions
# Wiki
[Refer to the Wiki](https://github.com/rly0nheart/reddit-post-scraping-tool/wiki) for installation instructions, in addition to all other documentation.
@@ -22,7 +22,7 @@ Given a subreddit name and a keyword, this script will return all posts from a s
> This is one of the projects I am working on, while learning Visual Basic, so the implementation/code may be messed up. If that's the case, please feel free to open a pull request using the available templates. Otherwise, enjoy!
# Donations
If you've got some change to spare and would like to show support, you can Buy Me A Coffee using the button below
If you like `Reddit Post Scraping Tool` and would like to show support, you can Buy A Coffee for the developer using the button below
<a href="https://www.buymeacoffee.com/189381184" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>

View File

@@ -10,14 +10,17 @@
<Company>Richard Mwewa</Company>
<Description>Given a subreddit name and a keyword, this program returns all top (by default) posts that contain the specified keyword. </Description>
<Copyright>Copyright (c) 2023 Richard Mwewa. All rights reserved.</Copyright>
<PackageProjectUrl>https://github.com/rly0nheart/reddit-post-scraping-tool</PackageProjectUrl>
<PackageProjectUrl>https://github.com/bellingcat/reddit-post-scraping-tool</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/rly0nheart/reddit-post-scraping-tool</RepositoryUrl>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
<RepositoryUrl>https://github.com/bellingcat/reddit-post-scraping-tool</RepositoryUrl>
<AssemblyVersion>1.2.0.1</AssemblyVersion>
<FileVersion>1.2.0.1</FileVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<Version>1.1.0</Version>
<Version>1.2.0</Version>
<PackageTags>reddit;scraper;reddit-scraper;osint</PackageTags>
<PackageReleaseNotes>Deploys to new PyPI
Minor improvements</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>

View File

@@ -25,7 +25,6 @@ Partial Class StartForm
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(StartForm))
Me.KeywordTextBox = New System.Windows.Forms.TextBox()
Me.LimitTextBox = New System.Windows.Forms.TextBox()
Me.SubredditTextBox = New System.Windows.Forms.TextBox()
Me.Button1 = New System.Windows.Forms.Button()
Me.TimeframeComboBox = New System.Windows.Forms.ComboBox()
@@ -37,38 +36,35 @@ Partial Class StartForm
Me.Label5 = New System.Windows.Forms.Label()
Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.SaveResultsJSONToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.MenuStrip1 = New System.Windows.Forms.MenuStrip()
Me.JSONToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.CSVToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.FileMenuStrip = New System.Windows.Forms.MenuStrip()
Me.ToolsToolStripMenuTools = New System.Windows.Forms.ToolStripMenuItem()
Me.AboutToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.LicensceToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.DeveloperToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ChekUpdatesToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripSeparator2 = New System.Windows.Forms.ToolStripSeparator()
Me.QuitToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ChekUpdatesToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.LimitNumericUpDown = New System.Windows.Forms.NumericUpDown()
Me.ContextMenuStrip1.SuspendLayout()
Me.MenuStrip1.SuspendLayout()
Me.FileMenuStrip.SuspendLayout()
CType(Me.LimitNumericUpDown, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'KeywordTextBox
'
Me.KeywordTextBox.BackColor = System.Drawing.SystemColors.Window
Me.KeywordTextBox.ForeColor = System.Drawing.SystemColors.WindowText
Me.KeywordTextBox.Location = New System.Drawing.Point(89, 96)
Me.KeywordTextBox.Location = New System.Drawing.Point(89, 60)
Me.KeywordTextBox.Name = "KeywordTextBox"
Me.KeywordTextBox.PlaceholderText = "Keyword"
Me.KeywordTextBox.Size = New System.Drawing.Size(100, 23)
Me.KeywordTextBox.TabIndex = 0
'
'LimitTextBox
'
Me.LimitTextBox.Location = New System.Drawing.Point(89, 154)
Me.LimitTextBox.Name = "LimitTextBox"
Me.LimitTextBox.PlaceholderText = "Limit (1-100)"
Me.LimitTextBox.Size = New System.Drawing.Size(100, 23)
Me.LimitTextBox.TabIndex = 3
'
'SubredditTextBox
'
Me.SubredditTextBox.Location = New System.Drawing.Point(89, 125)
Me.SubredditTextBox.Location = New System.Drawing.Point(89, 92)
Me.SubredditTextBox.Name = "SubredditTextBox"
Me.SubredditTextBox.PlaceholderText = "Subreddit"
Me.SubredditTextBox.Size = New System.Drawing.Size(100, 23)
@@ -76,7 +72,7 @@ Partial Class StartForm
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(251, 215)
Me.Button1.Location = New System.Drawing.Point(257, 191)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(76, 28)
Me.Button1.TabIndex = 6
@@ -87,7 +83,7 @@ Partial Class StartForm
'
Me.TimeframeComboBox.FormattingEnabled = True
Me.TimeframeComboBox.Items.AddRange(New Object() {"Hour", "Day", "Week", "Month", "Year"})
Me.TimeframeComboBox.Location = New System.Drawing.Point(89, 212)
Me.TimeframeComboBox.Location = New System.Drawing.Point(89, 191)
Me.TimeframeComboBox.Name = "TimeframeComboBox"
Me.TimeframeComboBox.Size = New System.Drawing.Size(100, 23)
Me.TimeframeComboBox.TabIndex = 8
@@ -97,7 +93,7 @@ Partial Class StartForm
'
Me.ListingComboBox.FormattingEnabled = True
Me.ListingComboBox.Items.AddRange(New Object() {"Controversial", "Hot", "Best", "New", "Rising"})
Me.ListingComboBox.Location = New System.Drawing.Point(89, 183)
Me.ListingComboBox.Location = New System.Drawing.Point(89, 157)
Me.ListingComboBox.Name = "ListingComboBox"
Me.ListingComboBox.Size = New System.Drawing.Size(100, 23)
Me.ListingComboBox.TabIndex = 9
@@ -108,7 +104,7 @@ Partial Class StartForm
Me.Label1.AutoEllipsis = True
Me.Label1.Font = New System.Drawing.Font("Segoe UI Semibold", 9.0!, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point)
Me.Label1.ForeColor = System.Drawing.Color.Black
Me.Label1.Location = New System.Drawing.Point(12, 96)
Me.Label1.Location = New System.Drawing.Point(12, 60)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(56, 23)
Me.Label1.TabIndex = 10
@@ -119,7 +115,7 @@ Partial Class StartForm
Me.Label2.AutoEllipsis = True
Me.Label2.Font = New System.Drawing.Font("Segoe UI Semibold", 9.0!, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point)
Me.Label2.ForeColor = System.Drawing.Color.Black
Me.Label2.Location = New System.Drawing.Point(12, 125)
Me.Label2.Location = New System.Drawing.Point(12, 92)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(63, 23)
Me.Label2.TabIndex = 11
@@ -130,7 +126,7 @@ Partial Class StartForm
Me.Label3.AutoEllipsis = True
Me.Label3.Font = New System.Drawing.Font("Segoe UI Semibold", 9.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point)
Me.Label3.ForeColor = System.Drawing.Color.Black
Me.Label3.Location = New System.Drawing.Point(12, 154)
Me.Label3.Location = New System.Drawing.Point(12, 125)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(56, 23)
Me.Label3.TabIndex = 12
@@ -141,7 +137,7 @@ Partial Class StartForm
Me.Label4.AutoEllipsis = True
Me.Label4.Font = New System.Drawing.Font("Segoe UI Semibold", 9.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point)
Me.Label4.ForeColor = System.Drawing.Color.Black
Me.Label4.Location = New System.Drawing.Point(12, 183)
Me.Label4.Location = New System.Drawing.Point(12, 157)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(56, 23)
Me.Label4.TabIndex = 13
@@ -152,7 +148,7 @@ Partial Class StartForm
Me.Label5.AutoEllipsis = True
Me.Label5.Font = New System.Drawing.Font("Segoe UI Semibold", 9.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point)
Me.Label5.ForeColor = System.Drawing.Color.Black
Me.Label5.Location = New System.Drawing.Point(12, 215)
Me.Label5.Location = New System.Drawing.Point(12, 191)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(71, 23)
Me.Label5.TabIndex = 14
@@ -162,69 +158,107 @@ Partial Class StartForm
'
Me.ContextMenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.SaveResultsJSONToolStripMenuItem})
Me.ContextMenuStrip1.Name = "ContextMenuStrip1"
Me.ContextMenuStrip1.Size = New System.Drawing.Size(175, 26)
Me.ContextMenuStrip1.Size = New System.Drawing.Size(144, 26)
'
'SaveResultsJSONToolStripMenuItem
'
Me.SaveResultsJSONToolStripMenuItem.CheckOnClick = True
Me.SaveResultsJSONToolStripMenuItem.AutoToolTip = True
Me.SaveResultsJSONToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.JSONToolStripMenuItem, Me.CSVToolStripMenuItem})
Me.SaveResultsJSONToolStripMenuItem.Image = CType(resources.GetObject("SaveResultsJSONToolStripMenuItem.Image"), System.Drawing.Image)
Me.SaveResultsJSONToolStripMenuItem.Name = "SaveResultsJSONToolStripMenuItem"
Me.SaveResultsJSONToolStripMenuItem.Size = New System.Drawing.Size(174, 22)
Me.SaveResultsJSONToolStripMenuItem.Text = "Save results (JSON)"
Me.SaveResultsJSONToolStripMenuItem.Size = New System.Drawing.Size(143, 22)
Me.SaveResultsJSONToolStripMenuItem.Text = "Save posts to"
Me.SaveResultsJSONToolStripMenuItem.ToolTipText = "Save results to a JSON file"
'
'MenuStrip1
'JSONToolStripMenuItem
'
Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolsToolStripMenuTools})
Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
Me.MenuStrip1.Name = "MenuStrip1"
Me.MenuStrip1.Size = New System.Drawing.Size(355, 24)
Me.MenuStrip1.TabIndex = 0
Me.MenuStrip1.Text = "MenuStrip1"
Me.JSONToolStripMenuItem.AutoToolTip = True
Me.JSONToolStripMenuItem.CheckOnClick = True
Me.JSONToolStripMenuItem.Image = CType(resources.GetObject("JSONToolStripMenuItem.Image"), System.Drawing.Image)
Me.JSONToolStripMenuItem.Name = "JSONToolStripMenuItem"
Me.JSONToolStripMenuItem.Size = New System.Drawing.Size(185, 22)
Me.JSONToolStripMenuItem.Text = "JSON"
'
'CSVToolStripMenuItem
'
Me.CSVToolStripMenuItem.AutoToolTip = True
Me.CSVToolStripMenuItem.Enabled = False
Me.CSVToolStripMenuItem.Image = CType(resources.GetObject("CSVToolStripMenuItem.Image"), System.Drawing.Image)
Me.CSVToolStripMenuItem.Name = "CSVToolStripMenuItem"
Me.CSVToolStripMenuItem.Size = New System.Drawing.Size(185, 22)
Me.CSVToolStripMenuItem.Text = "CSV (coming soon...)"
'
'FileMenuStrip
'
Me.FileMenuStrip.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolsToolStripMenuTools})
Me.FileMenuStrip.Location = New System.Drawing.Point(0, 0)
Me.FileMenuStrip.Name = "FileMenuStrip"
Me.FileMenuStrip.Size = New System.Drawing.Size(355, 24)
Me.FileMenuStrip.TabIndex = 0
Me.FileMenuStrip.Text = "MenuStrip1"
'
'ToolsToolStripMenuTools
'
Me.ToolsToolStripMenuTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.AboutToolStripMenuItem, Me.DeveloperToolStripMenuItem, Me.ChekUpdatesToolStripMenuItem, Me.ToolStripSeparator2, Me.QuitToolStripMenuItem})
Me.ToolsToolStripMenuTools.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.AboutToolStripMenuItem, Me.LicensceToolStripMenuItem, Me.DeveloperToolStripMenuItem, Me.ChekUpdatesToolStripMenuItem, Me.ToolStripSeparator2, Me.QuitToolStripMenuItem})
Me.ToolsToolStripMenuTools.Image = CType(resources.GetObject("ToolsToolStripMenuTools.Image"), System.Drawing.Image)
Me.ToolsToolStripMenuTools.Name = "ToolsToolStripMenuTools"
Me.ToolsToolStripMenuTools.Size = New System.Drawing.Size(62, 20)
Me.ToolsToolStripMenuTools.Text = "Tools"
Me.ToolsToolStripMenuTools.Size = New System.Drawing.Size(53, 20)
Me.ToolsToolStripMenuTools.Text = "File"
'
'AboutToolStripMenuItem
'
Me.AboutToolStripMenuItem.AutoToolTip = True
Me.AboutToolStripMenuItem.Image = CType(resources.GetObject("AboutToolStripMenuItem.Image"), System.Drawing.Image)
Me.AboutToolStripMenuItem.Name = "AboutToolStripMenuItem"
Me.AboutToolStripMenuItem.Size = New System.Drawing.Size(180, 22)
Me.AboutToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
Me.AboutToolStripMenuItem.Text = "About"
Me.AboutToolStripMenuItem.ToolTipText = "About program"
'
'LicensceToolStripMenuItem
'
Me.LicensceToolStripMenuItem.AutoToolTip = True
Me.LicensceToolStripMenuItem.Image = CType(resources.GetObject("LicensceToolStripMenuItem.Image"), System.Drawing.Image)
Me.LicensceToolStripMenuItem.Name = "LicensceToolStripMenuItem"
Me.LicensceToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
Me.LicensceToolStripMenuItem.Text = "License"
'
'DeveloperToolStripMenuItem
'
Me.DeveloperToolStripMenuItem.AutoToolTip = True
Me.DeveloperToolStripMenuItem.Image = CType(resources.GetObject("DeveloperToolStripMenuItem.Image"), System.Drawing.Image)
Me.DeveloperToolStripMenuItem.Name = "DeveloperToolStripMenuItem"
Me.DeveloperToolStripMenuItem.Size = New System.Drawing.Size(180, 22)
Me.DeveloperToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
Me.DeveloperToolStripMenuItem.Text = "Developer"
Me.DeveloperToolStripMenuItem.ToolTipText = "About developer"
'
'ChekUpdatesToolStripMenuItem
'
Me.ChekUpdatesToolStripMenuItem.AutoToolTip = True
Me.ChekUpdatesToolStripMenuItem.Image = CType(resources.GetObject("ChekUpdatesToolStripMenuItem.Image"), System.Drawing.Image)
Me.ChekUpdatesToolStripMenuItem.Name = "ChekUpdatesToolStripMenuItem"
Me.ChekUpdatesToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
Me.ChekUpdatesToolStripMenuItem.Text = "Check updates"
'
'ToolStripSeparator2
'
Me.ToolStripSeparator2.Name = "ToolStripSeparator2"
Me.ToolStripSeparator2.Size = New System.Drawing.Size(177, 6)
Me.ToolStripSeparator2.Size = New System.Drawing.Size(149, 6)
'
'QuitToolStripMenuItem
'
Me.QuitToolStripMenuItem.AutoToolTip = True
Me.QuitToolStripMenuItem.Image = CType(resources.GetObject("QuitToolStripMenuItem.Image"), System.Drawing.Image)
Me.QuitToolStripMenuItem.Name = "QuitToolStripMenuItem"
Me.QuitToolStripMenuItem.Size = New System.Drawing.Size(180, 22)
Me.QuitToolStripMenuItem.Size = New System.Drawing.Size(152, 22)
Me.QuitToolStripMenuItem.Text = "Quit"
Me.QuitToolStripMenuItem.ToolTipText = "Quit program"
'
'ChekUpdatesToolStripMenuItem
'LimitNumericUpDown
'
Me.ChekUpdatesToolStripMenuItem.Image = CType(resources.GetObject("ChekUpdatesToolStripMenuItem.Image"), System.Drawing.Image)
Me.ChekUpdatesToolStripMenuItem.Name = "ChekUpdatesToolStripMenuItem"
Me.ChekUpdatesToolStripMenuItem.Size = New System.Drawing.Size(180, 22)
Me.ChekUpdatesToolStripMenuItem.Text = "Check updates"
Me.LimitNumericUpDown.Location = New System.Drawing.Point(89, 125)
Me.LimitNumericUpDown.Minimum = New Decimal(New Integer() {5, 0, 0, 0})
Me.LimitNumericUpDown.Name = "LimitNumericUpDown"
Me.LimitNumericUpDown.ReadOnly = True
Me.LimitNumericUpDown.Size = New System.Drawing.Size(100, 23)
Me.LimitNumericUpDown.TabIndex = 15
Me.LimitNumericUpDown.Value = New Decimal(New Integer() {5, 0, 0, 0})
'
'StartForm
'
@@ -233,7 +267,8 @@ Partial Class StartForm
Me.BackColor = System.Drawing.Color.White
Me.ClientSize = New System.Drawing.Size(355, 255)
Me.ContextMenuStrip = Me.ContextMenuStrip1
Me.Controls.Add(Me.MenuStrip1)
Me.Controls.Add(Me.LimitNumericUpDown)
Me.Controls.Add(Me.FileMenuStrip)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
@@ -242,26 +277,25 @@ Partial Class StartForm
Me.Controls.Add(Me.ListingComboBox)
Me.Controls.Add(Me.TimeframeComboBox)
Me.Controls.Add(Me.SubredditTextBox)
Me.Controls.Add(Me.LimitTextBox)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.KeywordTextBox)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MainMenuStrip = Me.MenuStrip1
Me.MainMenuStrip = Me.FileMenuStrip
Me.MaximizeBox = False
Me.Name = "StartForm"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Reddit Post Scraping Tool"
Me.ContextMenuStrip1.ResumeLayout(False)
Me.MenuStrip1.ResumeLayout(False)
Me.MenuStrip1.PerformLayout()
Me.FileMenuStrip.ResumeLayout(False)
Me.FileMenuStrip.PerformLayout()
CType(Me.LimitNumericUpDown, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents KeywordTextBox As TextBox
Friend WithEvents LimitTextBox As TextBox
Friend WithEvents SubredditTextBox As TextBox
Friend WithEvents Button1 As Button
Friend WithEvents TimeframeComboBox As ComboBox
@@ -272,7 +306,7 @@ Partial Class StartForm
Friend WithEvents Label4 As Label
Friend WithEvents Label5 As Label
Friend WithEvents ContextMenuStrip1 As ContextMenuStrip
Friend WithEvents MenuStrip1 As MenuStrip
Friend WithEvents FileMenuStrip As MenuStrip
Friend WithEvents ToolsToolStripMenuTools As ToolStripMenuItem
Friend WithEvents AboutToolStripMenuItem As ToolStripMenuItem
Friend WithEvents DeveloperToolStripMenuItem As ToolStripMenuItem
@@ -280,4 +314,8 @@ Partial Class StartForm
Friend WithEvents QuitToolStripMenuItem As ToolStripMenuItem
Friend WithEvents SaveResultsJSONToolStripMenuItem As ToolStripMenuItem
Friend WithEvents ChekUpdatesToolStripMenuItem As ToolStripMenuItem
Friend WithEvents LicensceToolStripMenuItem As ToolStripMenuItem
Friend WithEvents JSONToolStripMenuItem As ToolStripMenuItem
Friend WithEvents CSVToolStripMenuItem As ToolStripMenuItem
Friend WithEvents LimitNumericUpDown As NumericUpDown
End Class

View File

@@ -1,5 +1,4 @@
Imports System.IO
Imports System.Reflection
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
@@ -18,6 +17,31 @@ Public Class StartForm
End Sub
Private Sub LicenseNotice()
MessageBox.Show("MIT License
Copyright (c) 2023 Richard Mwewa
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the ""Software""), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.", "License", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
' Create a file in C:\Users\<username>\AppData\Roaming\RedditPostScrapingTool, this will be used to determine
' Whether the program has been run before
' If it has not been run before, display the license notice
@@ -35,28 +59,7 @@ x64: {Environment.Is64BitOperatingSystem}
First launched on: {DateTime.Now}"
If Not File.Exists(filePath) Then
MessageBox.Show("MIT License
Copyright (c) 2023 Richard Mwewa
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the ""Software""), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.", "License", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
LicenseNotice()
File.WriteAllText(filePath, textToWrite)
Else
' DO NOTHING
@@ -78,8 +81,11 @@ SOFTWARE.", "License", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
SubredditTextBox.BackColor = ColorTranslator.FromHtml("#FFFFFFFF")
SubredditTextBox.ForeColor = ColorTranslator.FromHtml("#FF121212")
LimitTextBox.BackColor = ColorTranslator.FromHtml("#FFFFFFFF")
LimitTextBox.ForeColor = ColorTranslator.FromHtml("#FF121212")
LimitNumericUpDown.BackColor = ColorTranslator.FromHtml("#FFFFFFFF")
LimitNumericUpDown.ForeColor = ColorTranslator.FromHtml("#FF121212")
LimitNumericUpDown.BackColor = ColorTranslator.FromHtml("#FFFFFFFF")
LimitNumericUpDown.ForeColor = ColorTranslator.FromHtml("#FF121212")
ListingComboBox.BackColor = ColorTranslator.FromHtml("#FFFFFFFF")
ListingComboBox.ForeColor = ColorTranslator.FromHtml("#FF121212")
@@ -101,8 +107,10 @@ SOFTWARE.", "License", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
SubredditTextBox.BackColor = ColorTranslator.FromHtml("#FF2E2E2E")
SubredditTextBox.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF")
LimitTextBox.BackColor = ColorTranslator.FromHtml("#FF2E2E2E")
LimitTextBox.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF")
LimitNumericUpDown.BackColor = ColorTranslator.FromHtml("#FF2E2E2E")
LimitNumericUpDown.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF")
LimitNumericUpDown.BackColor = ColorTranslator.FromHtml("#FF2E2E2E")
LimitNumericUpDown.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF")
ListingComboBox.BackColor = ColorTranslator.FromHtml("#FF2E2E2E")
ListingComboBox.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF")
@@ -124,7 +132,7 @@ SOFTWARE.", "License", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
Dim Keyword As String = KeywordTextBox.Text
Dim Subreddit As String = SubredditTextBox.Text
Dim Listing As String = ListingComboBox.Text.ToLower()
Dim Limit As String = LimitTextBox.Text
Dim Limit As Integer = LimitNumericUpDown.Value
Dim Timeframe As String = TimeframeComboBox.Text.ToLower()
Dim FoundPosts As Integer = 0
Dim TotalPosts As Integer = 0
@@ -156,9 +164,7 @@ SOFTWARE.", "License", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
PostsForm.DataGridViewPosts.Columns.Add("PostApprovedAt", "Approved At")
PostsForm.DataGridViewPosts.Columns.Add("PostApprovedBy", "Approved By")
If Limit = "" Then
Limit = "10"
ElseIf Limit > 100 Then
If Limit > 100 Then
MessageBox.Show("Limit should not be over 100. Defaulting to 10", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If
@@ -189,20 +195,29 @@ SOFTWARE.", "License", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
Post("data")("approved_at_utc"), Post("data")("approved_by"))
End If
Next
MessageBox.Show($"Keyword `{Keyword}` was found in {FoundPosts}/" + Posts("data")("children").Count.ToString _
+ $" {Listing} posts from r/{Subreddit}", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
PostsForm.Show()
If SaveResultsJSONToolStripMenuItem.Checked Then
'Don't show the results form if found posts are not greater than 0
If FoundPosts > 0 Then
MessageBox.Show($"Keyword `{Keyword}` was found in {FoundPosts}/" + Posts("data")("children").Count.ToString _
+ $" {Listing} posts from r/{Subreddit}", "Found", MessageBoxButtons.OK, MessageBoxIcon.Information)
PostsForm.Show()
Else
MessageBox.Show($"Keyword `{Keyword}` was not found in either one of the " + Posts("data")("children").Count.ToString _
+ $" {Listing} posts from r/{Subreddit}", "Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If
If JSONToolStripMenuItem.Checked Then
Dim saveFileDialog As New SaveFileDialog()
saveFileDialog.Filter = "JSON files (*.json)|*.json"
saveFileDialog.Title = "Save JSON File"
saveFileDialog.Title = "Save posts to JSON"
If saveFileDialog.ShowDialog() = DialogResult.OK Then
Dim fileName As String = saveFileDialog.FileName
Dim serializerSettings As New JsonSerializerSettings()
serializerSettings.Formatting = Formatting.Indented
Dim json As String = JsonConvert.SerializeObject(Posts("data")("children")(0), serializerSettings)
Dim json As String = JsonConvert.SerializeObject(Posts("data"), serializerSettings)
System.IO.File.WriteAllText(fileName, json)
@@ -212,6 +227,7 @@ SOFTWARE.", "License", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
End If
End Sub
' StartForm load event
Private Sub StartForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
PathFinder()
LogFirstTimeLaunch()
@@ -221,16 +237,7 @@ SOFTWARE.", "License", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
End Sub
Private Sub AboutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AboutToolStripMenuItem.Click
Dim response As DialogResult = MessageBox.Show("This will open the program's Wiki page in browser, continue?", "About", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If response = DialogResult.Yes Then
Shell("cmd /c start https:github.com/rly0nheart/reddit-post-scraping-tool/wiki")
Else
' DO NOTHING
End If
' About infomation, the description of the release is taken from the GitHub releases page
' This will throw an exception if there is no internet
' Check line 34 - 57 in the ApiHandler.vb class file
Shell("cmd /c start https:github.com/bellingcat/reddit-post-scraping-tool/wiki")
End Sub
Private Sub QuitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles QuitToolStripMenuItem.Click
@@ -241,7 +248,7 @@ SOFTWARE.", "License", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
End Sub
Private Sub DeveloperToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DeveloperToolStripMenuItem.Click
DeveloperForm.Show()
DeveloperForm.ShowDialog()
End Sub
Private Sub ChekUpdatesToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ChekUpdatesToolStripMenuItem.Click
@@ -256,9 +263,13 @@ What's new in v{data("tag_name")}?
{data("body")}
", "Update", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If confirm = DialogResult.Yes Then
Shell($"cmd /c start https://github.com/rly0nheart/reddit-post-scraping-tool/releases/tag/{data("tag_name")}")
Shell($"cmd /c start https://github.com/bellingcat/reddit-post-scraping-tool/releases/tag/{data("tag_name")}")
End If
End If
End Sub
Private Sub LicensceToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LicensceToolStripMenuItem.Click
LicenseNotice()
End Sub
End Class

View File

@@ -0,0 +1,30 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
Imports System
Imports System.Reflection
<Assembly: System.Reflection.AssemblyCompanyAttribute("Richard Mwewa"), _
Assembly: System.Reflection.AssemblyConfigurationAttribute("Debug"), _
Assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright (c) 2023 Richard Mwewa. All rights reserved."), _
Assembly: System.Reflection.AssemblyDescriptionAttribute("Given a subreddit name and a keyword, this program returns all top (by default) p"& _
"osts that contain the specified keyword. "), _
Assembly: System.Reflection.AssemblyFileVersionAttribute("1.2.0.1"), _
Assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.2.0"), _
Assembly: System.Reflection.AssemblyProductAttribute("Reddit Post Scraping Tool"), _
Assembly: System.Reflection.AssemblyTitleAttribute("Reddit Post Scraping Tool"), _
Assembly: System.Reflection.AssemblyVersionAttribute("1.2.0.1"), _
Assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/bellingcat/reddit-post-scraping-tool"), _
Assembly: System.Runtime.Versioning.TargetPlatformAttribute("Windows7.0"), _
Assembly: System.Runtime.Versioning.SupportedOSPlatformAttribute("Windows7.0")>
'Generated by the MSBuild WriteCodeFragment class.

View File

@@ -0,0 +1,17 @@
is_global = true
build_property.ApplicationManifest =
build_property.StartupObject = Reddit_Post_Scraping_Tool.My.MyApplication
build_property.ApplicationDefaultFont =
build_property.ApplicationHighDpiMode =
build_property.ApplicationUseCompatibleTextRendering =
build_property.ApplicationVisualStyles =
build_property.TargetFramework = net6.0-windows
build_property.TargetPlatformMinVersion = 7.0
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Reddit_Post_Scraping_Tool
build_property.ProjectDir = C:\Users\rly0nheart\Documents\Visual Studio 2022\VB.Net Projects\Reddit Post Scraping Tool\Reddit Post Scraping Tool\