Merge pull request #5 from bellingcat/dev

Dev
This commit is contained in:
Richard Mwewa
2023-08-08 07:15:29 +02:00
committed by GitHub
24 changed files with 1419 additions and 1231 deletions

View File

@@ -1,12 +1,9 @@
# RPST (Reddit Post Scraping Tool)
Given a subreddit name and a keyword, this script will return all posts from a specified listing (default is 'top') that contain the provided keyword.
Given a subreddit name and a keyword, RPST will return all posts from a specified listing (default is 'top') that contain the provided keyword.
[![Upload Python Package](https://github.com/rly0nheart/reddit-post-scraping-tool/actions/workflows/python-publish.yml/badge.svg)](https://github.com/rly0nheart/reddit-post-scraping-tool/actions/workflows/python-publish.yml) [![CodeQL](https://github.com/rly0nheart/reddit-post-scraping-tool/actions/workflows/codeql.yml/badge.svg)](https://github.com/rly0nheart/reddit-post-scraping-tool/actions/workflows/codeql.yml) ![.Net](https://img.shields.io/badge/.NET-5C2D91?style=flat&logo=.net&logoColor=white) ![Python](https://img.shields.io/badge/python-3670A0?style=flat&logo=python&logoColor=ffdd54)
![2023-08-07_02-13_1](https://github.com/bellingcat/reddit-post-scraping-tool/assets/74001397/5ea98745-8b5f-4a93-9a53-befa491f7b6a)
![2023-08-07_02-13](https://github.com/bellingcat/reddit-post-scraping-tool/assets/74001397/f303abc7-8a83-44b0-97c9-a447c459cef9)
![2023-08-08_07-04](https://github.com/bellingcat/reddit-post-scraping-tool/assets/74001397/10d91093-7b24-4de9-9f02-454b842d6b8e)
![2023-08-08_07-04_1](https://github.com/bellingcat/reddit-post-scraping-tool/assets/74001397/268a4c0e-d849-49a3-94ba-296d193774e1)
# ✅ Features

View File

@@ -59,32 +59,32 @@ Partial Class AboutBox
' LabelProgramDescription
'
LabelProgramDescription.AutoSize = True
LabelProgramDescription.Font = New Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point)
LabelProgramDescription.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Bold, GraphicsUnit.Point)
LabelProgramDescription.ForeColor = SystemColors.ControlText
LabelProgramDescription.Location = New Point(4, 54)
LabelProgramDescription.Name = "LabelProgramDescription"
LabelProgramDescription.Size = New Size(73, 17)
LabelProgramDescription.Size = New Size(68, 15)
LabelProgramDescription.TabIndex = 4
LabelProgramDescription.Text = "Description"
'
' LabelVersion
'
LabelVersion.AutoSize = True
LabelVersion.Font = New Font("Comic Sans MS", 9F, FontStyle.Underline, GraphicsUnit.Point)
LabelVersion.Font = New Font("Segoe UI", 9F, FontStyle.Underline, GraphicsUnit.Point)
LabelVersion.ForeColor = SystemColors.ControlText
LabelVersion.Location = New Point(372, 17)
LabelVersion.Name = "LabelVersion"
LabelVersion.Size = New Size(50, 17)
LabelVersion.Size = New Size(45, 15)
LabelVersion.TabIndex = 5
LabelVersion.Text = "Version"
'
' LinkLabelReadtheWiki
'
LinkLabelReadtheWiki.AutoSize = True
LinkLabelReadtheWiki.Font = New Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point)
LinkLabelReadtheWiki.Font = New Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point)
LinkLabelReadtheWiki.Location = New Point(337, 54)
LinkLabelReadtheWiki.Name = "LinkLabelReadtheWiki"
LinkLabelReadtheWiki.Size = New Size(85, 17)
LinkLabelReadtheWiki.Size = New Size(79, 15)
LinkLabelReadtheWiki.TabIndex = 6
LinkLabelReadtheWiki.TabStop = True
LinkLabelReadtheWiki.Text = "Read the Wiki"

View File

@@ -21,8 +21,8 @@ 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."
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
''' <summary>
''' Handles the Load event for the AboutBox form.
@@ -33,7 +33,7 @@ SOFTWARE."
settings.LoadSettings()
settings.ToggleDarkMode(settings.DarkMode)
LabelProgramName.Text = My.Application.Info.AssemblyName
LabelProgramName.Text = My.Application.Info.ProductName
LabelProgramDescription.Text = "Given a subreddit name and a keyword,
RPST returns all top posts
(by default) that contain the specified keyword."

View File

@@ -7,31 +7,31 @@ Public Class DataGridViewHandler
''' <param name="dataGridView">The DataGridView to be initialized.</param>
Public Shared Sub AddColumn(dataGridView As DataGridView)
' Clear the Columns and Rows before adding Items to them
PostsForm.DataGridViewPosts.Rows.Clear()
PostsForm.DataGridViewPosts.Columns.Clear()
dataGridView.Rows.Clear()
dataGridView.Columns.Clear()
PostsForm.DataGridViewPosts.Columns.Add("PostCount", "Post Number")
PostsForm.DataGridViewPosts.Columns.Add("PostAuthor", "Author")
PostsForm.DataGridViewPosts.Columns.Add("PostID", "ID")
PostsForm.DataGridViewPosts.Columns.Add("PostSubreddit", "Subreddit")
PostsForm.DataGridViewPosts.Columns.Add("SubredditVisibility", "Subreddit Visibility")
PostsForm.DataGridViewPosts.Columns.Add("PostThumbnail", "Thumbnail")
PostsForm.DataGridViewPosts.Columns.Add("PostIsNSFW", "NSFW")
PostsForm.DataGridViewPosts.Columns.Add("PostIsGilded", "Gilded")
PostsForm.DataGridViewPosts.Columns.Add("PostUpvotes", "Upvotes")
PostsForm.DataGridViewPosts.Columns.Add("PostUpvoteRatio", "Upvote Ratio")
PostsForm.DataGridViewPosts.Columns.Add("PostDownvotes", "Downvotes")
PostsForm.DataGridViewPosts.Columns.Add("PostAwards", "Awards")
PostsForm.DataGridViewPosts.Columns.Add("PostTopAward", "Top Award")
PostsForm.DataGridViewPosts.Columns.Add("PostIsCrosspostable", "Is Crosspostable?")
PostsForm.DataGridViewPosts.Columns.Add("PostScore", "Score")
PostsForm.DataGridViewPosts.Columns.Add("PostText", "Text")
PostsForm.DataGridViewPosts.Columns.Add("PostCategory", "Category")
PostsForm.DataGridViewPosts.Columns.Add("PostDomain", "Domain")
PostsForm.DataGridViewPosts.Columns.Add("PostPermalink", "Permalink")
PostsForm.DataGridViewPosts.Columns.Add("PostCreatedAt", "Created At")
PostsForm.DataGridViewPosts.Columns.Add("PostApprovedAt", "Approved At")
PostsForm.DataGridViewPosts.Columns.Add("PostApprovedBy", "Approved By")
dataGridView.Columns.Add("PostCount", "Index")
dataGridView.Columns.Add("PostAuthor", "Author")
dataGridView.Columns.Add("PostID", "Post ID")
dataGridView.Columns.Add("PostText", "Post Text")
dataGridView.Columns.Add("PostSubreddit", "Subreddit")
dataGridView.Columns.Add("SubredditVisibility", "Subreddit Visibility")
dataGridView.Columns.Add("PostThumbnail", "Thumbnail")
dataGridView.Columns.Add("PostIsNSFW", "NSFW")
dataGridView.Columns.Add("PostIsGilded", "Gilded")
dataGridView.Columns.Add("PostUpvotes", "Upvotes")
dataGridView.Columns.Add("PostUpvoteRatio", "Upvote Ratio")
dataGridView.Columns.Add("PostDownvotes", "Downvotes")
dataGridView.Columns.Add("PostAwards", "Awards")
dataGridView.Columns.Add("PostTopAward", "Top Award")
dataGridView.Columns.Add("PostIsCrosspostable", "Is Crosspostable?")
dataGridView.Columns.Add("PostScore", "Score")
dataGridView.Columns.Add("PostCategory", "Category")
dataGridView.Columns.Add("PostDomain", "Domain")
dataGridView.Columns.Add("PostPermalink", "Permalink")
dataGridView.Columns.Add("PostCreatedAt", "Created At")
dataGridView.Columns.Add("PostApprovedAt", "Approved At")
dataGridView.Columns.Add("PostApprovedBy", "Approved By")
End Sub
Public Shared Sub AddRow(dataGridView As DataGridView, post As JObject, postNumber As Integer)
@@ -41,9 +41,10 @@ Public Class DataGridViewHandler
''' <param name="dataGridView">The DataGridView to which the row will be added.</param>
''' <param name="post">A JObject representing the Reddit post.</param>
''' <param name="postNumber">The number of the post.</param>
PostsForm.DataGridViewPosts.Rows.Add(postNumber,
dataGridView.Rows.Add(postNumber,
post("data")("author"),
post("data")("id"),
post("data")("selftext"),
post("data")("subreddit_name_prefixed"),
post("data")("subreddit_type"),
post("data")("thumbnail"),
@@ -56,7 +57,6 @@ Public Class DataGridViewHandler
post("data")("top_awarded_type"),
post("data")("is_crosspostable"),
post("data")("score"),
post("data")("selftext"),
post("data")("category"),
post("data")("domain"),
post("data")("permalink"),

View File

@@ -1,5 +1,5 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class DeveloperForm
Partial Class DeveloperBox
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
@@ -22,7 +22,7 @@ Partial Class DeveloperForm
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Dim resources As ComponentModel.ComponentResourceManager = New ComponentModel.ComponentResourceManager(GetType(DeveloperForm))
Dim resources As ComponentModel.ComponentResourceManager = New ComponentModel.ComponentResourceManager(GetType(DeveloperBox))
AboutMeLinkLabel = New LinkLabel()
LinkLabelBuyMeACoffee = New LinkLabel()
GreetingLabel = New Label()

View File

@@ -1,4 +1,4 @@
Public Class DeveloperForm
Public Class DeveloperBox
Private Sub DeveloperForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
GreetingLabel.BackColor = Color.Transparent
AboutMeLinkLabel.BackColor = Color.Transparent

View File

@@ -1,57 +0,0 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class PostsForm
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
DataGridViewPosts = New DataGridView()
CType(DataGridViewPosts, ComponentModel.ISupportInitialize).BeginInit()
SuspendLayout()
'
' DataGridViewPosts
'
DataGridViewPosts.BackgroundColor = Color.Gainsboro
DataGridViewPosts.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize
DataGridViewPosts.Dock = DockStyle.Fill
DataGridViewPosts.Location = New Point(0, 0)
DataGridViewPosts.Name = "DataGridViewPosts"
DataGridViewPosts.ReadOnly = True
DataGridViewPosts.RowHeadersVisible = False
DataGridViewPosts.RowTemplate.Height = 25
DataGridViewPosts.Size = New Size(800, 450)
DataGridViewPosts.TabIndex = 3
'
' PostsForm
'
AutoScaleDimensions = New SizeF(7F, 15F)
AutoScaleMode = AutoScaleMode.Font
ClientSize = New Size(800, 450)
Controls.Add(DataGridViewPosts)
Name = "PostsForm"
ShowIcon = False
ShowInTaskbar = False
Text = "PostsForm"
CType(DataGridViewPosts, ComponentModel.ISupportInitialize).EndInit()
ResumeLayout(False)
End Sub
Friend WithEvents DataGridViewPosts As DataGridView
End Class

View File

@@ -1,60 +0,0 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -1,3 +0,0 @@
Public Class PostsForm
End Class

View File

@@ -1,7 +1,7 @@
Imports Newtonsoft.Json.Linq
Public Class PostsProcessor
Private ApiHandler As New ApiHandler
Private ReadOnly ApiHandler As New ApiHandler
''' <summary>
''' Fetches Reddit posts based on the given parameters and returns them as a JObject.
@@ -23,7 +23,7 @@ Public Class PostsProcessor
''' <param name="keyword">The keyword to check for.</param>
''' <returns>True if the post contains the keyword, False otherwise.</returns>
Public Shared Function PostContainsKeyword(post As JObject, keyword As String) As Boolean
Return post("data")("selftext").ToString.ToLower(System.Globalization.CultureInfo.InvariantCulture).Contains(keyword.ToLower(System.Globalization.CultureInfo.InvariantCulture))
Return post("data")("selftext").ToString.ToLower(Globalization.CultureInfo.InvariantCulture).Contains(keyword.ToLower(System.Globalization.CultureInfo.InvariantCulture))
End Function
End Class

View File

@@ -1,12 +1,9 @@
# RPST (Reddit Post Scraping Tool)
Given a subreddit name and a keyword, this script will return all posts from a specified listing (default is 'top') that contain the provided keyword.
Given a subreddit name and a keyword, RPST will return all posts from a specified listing (default is 'top') that contain the provided keyword.
[![Upload Python Package](https://github.com/rly0nheart/reddit-post-scraping-tool/actions/workflows/python-publish.yml/badge.svg)](https://github.com/rly0nheart/reddit-post-scraping-tool/actions/workflows/python-publish.yml) [![CodeQL](https://github.com/rly0nheart/reddit-post-scraping-tool/actions/workflows/codeql.yml/badge.svg)](https://github.com/rly0nheart/reddit-post-scraping-tool/actions/workflows/codeql.yml) ![.Net](https://img.shields.io/badge/.NET-5C2D91?style=flat&logo=.net&logoColor=white) ![Python](https://img.shields.io/badge/python-3670A0?style=flat&logo=python&logoColor=ffdd54)
![2023-08-07_02-13_1](https://github.com/bellingcat/reddit-post-scraping-tool/assets/74001397/5ea98745-8b5f-4a93-9a53-befa491f7b6a)
![2023-08-07_02-13](https://github.com/bellingcat/reddit-post-scraping-tool/assets/74001397/f303abc7-8a83-44b0-97c9-a447c459cef9)
![2023-08-08_07-04](https://github.com/bellingcat/reddit-post-scraping-tool/assets/74001397/10d91093-7b24-4de9-9f02-454b842d6b8e)
![2023-08-08_07-04_1](https://github.com/bellingcat/reddit-post-scraping-tool/assets/74001397/268a4c0e-d849-49a3-94ba-296d193774e1)
# ✅ Features

View File

@@ -13,19 +13,19 @@
<PackageProjectUrl>https://github.com/bellingcat/reddit-post-scraping-tool</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/bellingcat/reddit-post-scraping-tool</RepositoryUrl>
<AssemblyVersion>1.4.1.0</AssemblyVersion>
<FileVersion>1.4.1.0</FileVersion>
<AssemblyVersion>1.5.0.0</AssemblyVersion>
<FileVersion>1.5.0.0</FileVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<Version>1.4.1</Version>
<Version>1.5.0</Version>
<PackageTags>reddit;scraper;reddit-scraper;osint</PackageTags>
<PackageReleaseNotes></PackageReleaseNotes>
<AnalysisLevel>6.0-recommended</AnalysisLevel>
<PackageId>RPST (Reddit Post Scraping Tool)</PackageId>
<PackageId>RPST</PackageId>
<Authors>Richard Mwewa</Authors>
<NeutralLanguage>en</NeutralLanguage>
<Product>$(AssemblyName)</Product>
<AssemblyName>RPST (Reddit Post Scraping Tool)</AssemblyName>
<Product>$(AssemblyName) (Reddit Post Scraping Tool)</Product>
<AssemblyName>RPST</AssemblyName>
</PropertyGroup>
<ItemGroup>

View File

@@ -4,10 +4,7 @@
<Compile Update="AboutBox.vb">
<SubType>Form</SubType>
</Compile>
<Compile Update="DeveloperForm.vb">
<SubType>Form</SubType>
</Compile>
<Compile Update="PostsForm.vb">
<Compile Update="DeveloperBox.vb">
<SubType>Form</SubType>
</Compile>
<Compile Update="StartForm.vb">

57
RPST GUI/RPST/ResultsForm.Designer.vb generated Normal file
View File

@@ -0,0 +1,57 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class ResultsForm
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
DataGridViewResults = New DataGridView()
CType(DataGridViewResults, ComponentModel.ISupportInitialize).BeginInit()
SuspendLayout()
'
' DataGridViewResults
'
DataGridViewResults.BackgroundColor = Color.Gainsboro
DataGridViewResults.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize
DataGridViewResults.Dock = DockStyle.Fill
DataGridViewResults.Location = New Point(0, 0)
DataGridViewResults.Name = "DataGridViewResults"
DataGridViewResults.ReadOnly = True
DataGridViewResults.RowHeadersVisible = False
DataGridViewResults.RowTemplate.Height = 25
DataGridViewResults.Size = New Size(800, 450)
DataGridViewResults.TabIndex = 3
'
' ResultsForm
'
AutoScaleDimensions = New SizeF(7.0F, 15.0F)
AutoScaleMode = AutoScaleMode.Font
ClientSize = New Size(800, 450)
Controls.Add(DataGridViewResults)
Name = "ResultsForm"
ShowIcon = False
ShowInTaskbar = False
Text = "ResultsForm"
CType(DataGridViewResults, ComponentModel.ISupportInitialize).EndInit()
ResumeLayout(False)
End Sub
Friend WithEvents DataGridViewResults As DataGridView
End Class

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1 @@


View File

@@ -25,7 +25,7 @@ Public Class SettingsManager
Dim options As New JsonSerializerOptions With {.PropertyNameCaseInsensitive = True}
Dim settings = Text.Json.JsonSerializer.Deserialize(Of SettingsManager)(json, options)
Me.DarkMode = settings.DarkMode
StartForm.DarkModeToolStripMenuItem.Checked = settings.DarkMode
StartForm.ToolStripMenuItemDarkMode.Checked = settings.DarkMode
Else
' Settings file does not exist
' Create a new file with default settings 'False'
@@ -34,7 +34,7 @@ Public Class SettingsManager
File.WriteAllText(settingsFilePath, jsonOutput)
Me.DarkMode = False
StartForm.DarkModeToolStripMenuItem.Checked = False
StartForm.ToolStripMenuItemDarkMode.Checked = False
End If
End Sub
@@ -46,7 +46,7 @@ Public Class SettingsManager
Public Sub ToggleDarkMode(enabled As Boolean)
Dim json As String = File.ReadAllText(settingsFilePath)
Dim options As New JsonSerializerOptions With {.PropertyNameCaseInsensitive = True}
Dim settings As SettingsManager = Text.Json.JsonSerializer.Deserialize(Of SettingsManager)(json, options)
Dim settings As SettingsManager = JsonSerializer.Deserialize(Of SettingsManager)(json, options)
settings.DarkMode = enabled
SaveSettings(settings)
ApplyTheme()
@@ -57,7 +57,7 @@ Public Class SettingsManager
''' </summary>
''' <param name="settings">An instance of the SettingsManager containing the configurations to be saved.</param>
Private Sub SaveSettings(settings)
Dim jsonOutput = Text.Json.JsonSerializer.Serialize(settings)
Dim jsonOutput = JsonSerializer.Serialize(settings)
File.WriteAllText(settingsFilePath, jsonOutput)
End Sub
@@ -70,69 +70,128 @@ Public Class SettingsManager
Dim DarkMode As Boolean = GetDarkMode()
If DarkMode Then
' Enable dark mode for the Main form
' Background colours (I know 'Colours'/'Colors'😆)
StartForm.BackColor = ColorTranslator.FromHtml("#FF121212")
StartForm.ToolsToolStripMenuTools.ForeColor = ColorTranslator.FromHtml("#FFFFFFFF")
StartForm.KeywordTextBox.BackColor = ColorTranslator.FromHtml("#FF2E2E2E")
StartForm.KeywordTextBox.ForeColor = SystemColors.Control
StartForm.SubredditTextBox.BackColor = ColorTranslator.FromHtml("#FF2E2E2E")
StartForm.SubredditTextBox.ForeColor = SystemColors.Control
StartForm.KeywordTextBox.BackColor = ColorTranslator.FromHtml("#FF2E2E2E")
StartForm.LimitNumericUpDown.BackColor = ColorTranslator.FromHtml("#FF2E2E2E")
StartForm.LimitNumericUpDown.ForeColor = SystemColors.Control
StartForm.LimitNumericUpDown.BackColor = ColorTranslator.FromHtml("#FF2E2E2E")
StartForm.LimitNumericUpDown.ForeColor = SystemColors.Control
StartForm.ListingComboBox.BackColor = ColorTranslator.FromHtml("#FF2E2E2E")
StartForm.ListingComboBox.ForeColor = SystemColors.Control
StartForm.TimeframeComboBox.BackColor = ColorTranslator.FromHtml("#FF2E2E2E")
' Foreground colours
StartForm.KeywordTextBox.ForeColor = SystemColors.Control
StartForm.SubredditTextBox.ForeColor = SystemColors.Control
StartForm.LimitNumericUpDown.ForeColor = SystemColors.Control
StartForm.LimitNumericUpDown.ForeColor = SystemColors.Control
StartForm.ListingComboBox.ForeColor = SystemColors.Control
StartForm.TimeframeComboBox.ForeColor = SystemColors.Control
StartForm.LabelRPST.ForeColor = SystemColors.Control
StartForm.LabelKeyword.ForeColor = SystemColors.Control
StartForm.LabelSubreddit.ForeColor = SystemColors.Control
StartForm.LabelLimit.ForeColor = SystemColors.Control
StartForm.LabelListing.ForeColor = SystemColors.Control
StartForm.LabelTimeframe.ForeColor = SystemColors.Control
ResultsForm.BackColor = ColorTranslator.FromHtml("#FF121212")
' Enable dark mode on 'Right Click Menu' items
' Background colours
StartForm.ToolStripMenuItemDarkMode.BackColor = ColorTranslator.FromHtml("#FF121212")
StartForm.ToolStripMenuItemSavePosts.BackColor = ColorTranslator.FromHtml("#FF121212")
StartForm.ToolStripMenuItemtoJSON.BackColor = ColorTranslator.FromHtml("#FF121212")
StartForm.ToolStripMenuItemtoCSV.BackColor = ColorTranslator.FromHtml("#FF121212")
StartForm.ToolStripMenuItemAbout.BackColor = ColorTranslator.FromHtml("#FF121212")
StartForm.ToolStripMenuItemDeveloper.BackColor = ColorTranslator.FromHtml("#FF121212")
StartForm.ToolStripMenuItemCheckUpdates.BackColor = ColorTranslator.FromHtml("#FF121212")
StartForm.ToolStripMenuItemQuit.BackColor = ColorTranslator.FromHtml("#FF121212")
' Foreground colours
StartForm.ToolStripMenuItemDarkMode.ForeColor = SystemColors.Control
StartForm.ToolStripMenuItemSavePosts.ForeColor = SystemColors.Control
StartForm.ToolStripMenuItemtoJSON.ForeColor = SystemColors.Control
StartForm.ToolStripMenuItemtoCSV.ForeColor = SystemColors.Control
StartForm.ToolStripMenuItemAbout.ForeColor = SystemColors.Control
StartForm.ToolStripMenuItemDeveloper.ForeColor = SystemColors.Control
StartForm.ToolStripMenuItemCheckUpdates.ForeColor = SystemColors.Control
StartForm.ToolStripMenuItemQuit.ForeColor = SystemColors.Control
' Enable dark mode for the About box
' Background colours
AboutBox.BackColor = ColorTranslator.FromHtml("#FF121212")
AboutBox.ForeColor = SystemColors.Control
AboutBox.LicenseRichTextBox.BackColor = ColorTranslator.FromHtml("#FF2E2E2E")
AboutBox.LicenseRichTextBox.ForeColor = SystemColors.Control
AboutBox.Panel1.BackColor = ColorTranslator.FromHtml("#FF121212")
' Foreground colours
AboutBox.ForeColor = SystemColors.Control
AboutBox.LicenseRichTextBox.ForeColor = SystemColors.Control
AboutBox.LabelProgramName.ForeColor = SystemColors.Control
AboutBox.LabelProgramDescription.ForeColor = SystemColors.Control
AboutBox.LabelVersion.ForeColor = SystemColors.Control
' If dark mode is enabled, set the 'Dark Mode' text value to 'Light mode'
StartForm.ToolStripMenuItemDarkMode.Text = "Light Mode"
Else
StartForm.BackColor = SystemColors.Control
StartForm.ToolsToolStripMenuTools.ForeColor = ColorTranslator.FromHtml("#FF121212")
' Disable dark mode for the Main Form
' Background colours
StartForm.BackColor = Color.Gainsboro
StartForm.KeywordTextBox.BackColor = SystemColors.Control
StartForm.KeywordTextBox.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.SubredditTextBox.BackColor = SystemColors.Control
StartForm.SubredditTextBox.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.LimitNumericUpDown.BackColor = SystemColors.Control
StartForm.LimitNumericUpDown.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.LimitNumericUpDown.BackColor = SystemColors.Control
StartForm.LimitNumericUpDown.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.ListingComboBox.BackColor = SystemColors.Control
StartForm.ListingComboBox.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.TimeframeComboBox.BackColor = SystemColors.Control
StartForm.ListingComboBox.BackColor = SystemColors.Control
' Foreground colours
StartForm.KeywordTextBox.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.SubredditTextBox.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.LimitNumericUpDown.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.LimitNumericUpDown.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.ListingComboBox.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.TimeframeComboBox.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.LabelRPST.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.LabelKeyword.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.LabelSubreddit.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.LabelLimit.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.LabelListing.ForeColor = ColorTranslator.FromHtml("#FF121212")
StartForm.LabelTimeframe.ForeColor = ColorTranslator.FromHtml("#FF121212")
' Disable dark mode on 'Right Click Menu' items
' Background colours
StartForm.ToolStripMenuItemDarkMode.BackColor = Color.Gainsboro
StartForm.ToolStripMenuItemSavePosts.BackColor = Color.Gainsboro
StartForm.ToolStripMenuItemtoJSON.BackColor = Color.Gainsboro
StartForm.ToolStripMenuItemtoCSV.BackColor = Color.Gainsboro
StartForm.ToolStripMenuItemAbout.BackColor = Color.Gainsboro
StartForm.ToolStripMenuItemDeveloper.BackColor = Color.Gainsboro
StartForm.ToolStripMenuItemCheckUpdates.BackColor = Color.Gainsboro
StartForm.ToolStripMenuItemQuit.BackColor = Color.Gainsboro
' Foreground colours
StartForm.ToolStripMenuItemDarkMode.ForeColor = Color.Black
StartForm.ToolStripMenuItemSavePosts.ForeColor = Color.Black
StartForm.ToolStripMenuItemtoJSON.ForeColor = Color.Black
StartForm.ToolStripMenuItemtoCSV.ForeColor = Color.Black
StartForm.ToolStripMenuItemAbout.ForeColor = Color.Black
StartForm.ToolStripMenuItemDeveloper.ForeColor = Color.Black
StartForm.ToolStripMenuItemCheckUpdates.ForeColor = Color.Black
StartForm.ToolStripMenuItemQuit.ForeColor = Color.Black
' Disable dark mode for the About box
' Background colours
AboutBox.BackColor = Color.Gainsboro
AboutBox.ForeColor = SystemColors.WindowText
AboutBox.LicenseRichTextBox.BackColor = SystemColors.Control
AboutBox.LicenseRichTextBox.ForeColor = SystemColors.WindowText
AboutBox.Panel1.BackColor = Color.Gainsboro
' Foreground colours
AboutBox.Panel1.ForeColor = SystemColors.WindowText
AboutBox.LabelProgramName.ForeColor = SystemColors.WindowText
AboutBox.LabelProgramDescription.ForeColor = SystemColors.WindowText
AboutBox.LabelVersion.ForeColor = SystemColors.WindowText
' If dark mode is disabled, set the 'Light Mode' text value to 'Dark Mode'
StartForm.ToolStripMenuItemDarkMode.Text = "Dark Mode"
End If
End Sub
''' <summary>
''' Retrieves the Dark Mode setting value from 'settings.json'.
''' If the settings file doesn't exist, defaults to returning 'False' (Dark Mode off).

View File

@@ -26,7 +26,7 @@ Partial Class StartForm
Dim resources As ComponentModel.ComponentResourceManager = New ComponentModel.ComponentResourceManager(GetType(StartForm))
KeywordTextBox = New TextBox()
SubredditTextBox = New TextBox()
ScrapeButton = New Button()
ButtonScrape = New Button()
TimeframeComboBox = New ComboBox()
ListingComboBox = New ComboBox()
LabelKeyword = New Label()
@@ -34,30 +34,28 @@ Partial Class StartForm
LabelLimit = New Label()
LabelListing = New Label()
LabelTimeframe = New Label()
ContextMenuStrip1 = New ContextMenuStrip(components)
SaveResultsStripMenuItem = New ToolStripMenuItem()
JSONToolStripMenuItem = New ToolStripMenuItem()
CSVToolStripMenuItem = New ToolStripMenuItem()
DarkModeToolStripMenuItem = New ToolStripMenuItem()
FileMenuStrip = New MenuStrip()
ToolsToolStripMenuTools = New ToolStripMenuItem()
AboutToolStripMenuItem = New ToolStripMenuItem()
DeveloperToolStripMenuItem = New ToolStripMenuItem()
CheckUpdatesToolStripMenuItem = New ToolStripMenuItem()
ToolStripSeparator2 = New ToolStripSeparator()
QuitToolStripMenuItem = New ToolStripMenuItem()
ContextMenuStripRightClick = New ContextMenuStrip(components)
ToolStripMenuItemDarkMode = New ToolStripMenuItem()
ToolStripMenuItemSavePosts = New ToolStripMenuItem()
ToolStripMenuItemtoJSON = New ToolStripMenuItem()
ToolStripMenuItemtoCSV = New ToolStripMenuItem()
ToolStripMenuItemAbout = New ToolStripMenuItem()
ToolStripMenuItemDeveloper = New ToolStripMenuItem()
ToolStripMenuItemCheckUpdates = New ToolStripMenuItem()
ToolStripMenuItemQuit = New ToolStripMenuItem()
LimitNumericUpDown = New NumericUpDown()
ToolTip1 = New ToolTip(components)
ContextMenuStrip1.SuspendLayout()
FileMenuStrip.SuspendLayout()
PictureBoxLogo = New PictureBox()
LabelRPST = New Label()
ContextMenuStripRightClick.SuspendLayout()
CType(LimitNumericUpDown, ComponentModel.ISupportInitialize).BeginInit()
CType(PictureBoxLogo, ComponentModel.ISupportInitialize).BeginInit()
SuspendLayout()
'
' KeywordTextBox
'
KeywordTextBox.BackColor = SystemColors.Window
KeywordTextBox.ForeColor = SystemColors.WindowText
KeywordTextBox.Location = New Point(89, 60)
KeywordTextBox.Location = New Point(159, 75)
KeywordTextBox.Name = "KeywordTextBox"
KeywordTextBox.PlaceholderText = "Keyword"
KeywordTextBox.Size = New Size(100, 23)
@@ -65,26 +63,26 @@ Partial Class StartForm
'
' SubredditTextBox
'
SubredditTextBox.Location = New Point(89, 92)
SubredditTextBox.Location = New Point(159, 106)
SubredditTextBox.Name = "SubredditTextBox"
SubredditTextBox.PlaceholderText = "Subreddit"
SubredditTextBox.Size = New Size(100, 23)
SubredditTextBox.TabIndex = 4
'
' ScrapeButton
' ButtonScrape
'
ScrapeButton.Location = New Point(257, 191)
ScrapeButton.Name = "ScrapeButton"
ScrapeButton.Size = New Size(76, 28)
ScrapeButton.TabIndex = 6
ScrapeButton.Text = "Scrape"
ScrapeButton.UseVisualStyleBackColor = True
ButtonScrape.Location = New Point(208, 29)
ButtonScrape.Name = "ButtonScrape"
ButtonScrape.Size = New Size(51, 28)
ButtonScrape.TabIndex = 6
ButtonScrape.Text = "Scrape"
ButtonScrape.UseVisualStyleBackColor = True
'
' TimeframeComboBox
'
TimeframeComboBox.FormattingEnabled = True
TimeframeComboBox.Items.AddRange(New Object() {"Hour", "Day", "Week", "Month", "Year"})
TimeframeComboBox.Location = New Point(89, 191)
TimeframeComboBox.Location = New Point(159, 200)
TimeframeComboBox.Name = "TimeframeComboBox"
TimeframeComboBox.Size = New Size(100, 23)
TimeframeComboBox.TabIndex = 8
@@ -94,7 +92,7 @@ Partial Class StartForm
'
ListingComboBox.FormattingEnabled = True
ListingComboBox.Items.AddRange(New Object() {"Controversial", "Hot", "Best", "New", "Rising"})
ListingComboBox.Location = New Point(89, 157)
ListingComboBox.Location = New Point(159, 168)
ListingComboBox.Name = "ListingComboBox"
ListingComboBox.Size = New Size(100, 23)
ListingComboBox.TabIndex = 9
@@ -103,159 +101,136 @@ Partial Class StartForm
' LabelKeyword
'
LabelKeyword.AutoEllipsis = True
LabelKeyword.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Underline, GraphicsUnit.Point)
LabelKeyword.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Bold Or FontStyle.Underline, GraphicsUnit.Point)
LabelKeyword.ForeColor = Color.Black
LabelKeyword.Location = New Point(12, 60)
LabelKeyword.Location = New Point(19, 78)
LabelKeyword.Name = "LabelKeyword"
LabelKeyword.Size = New Size(56, 23)
LabelKeyword.Size = New Size(71, 20)
LabelKeyword.TabIndex = 10
LabelKeyword.Text = "Keyword"
LabelKeyword.Text = "Keyword:"
'
' LabelSubreddit
'
LabelSubreddit.AutoEllipsis = True
LabelSubreddit.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Underline, GraphicsUnit.Point)
LabelSubreddit.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Bold Or FontStyle.Underline, GraphicsUnit.Point)
LabelSubreddit.ForeColor = Color.Black
LabelSubreddit.Location = New Point(12, 92)
LabelSubreddit.Location = New Point(19, 109)
LabelSubreddit.Name = "LabelSubreddit"
LabelSubreddit.Size = New Size(63, 23)
LabelSubreddit.Size = New Size(71, 23)
LabelSubreddit.TabIndex = 11
LabelSubreddit.Text = "Subreddit"
LabelSubreddit.Text = "Subreddit:"
'
' LabelLimit
'
LabelLimit.AutoEllipsis = True
LabelLimit.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Bold Or FontStyle.Underline, GraphicsUnit.Point)
LabelLimit.ForeColor = Color.Black
LabelLimit.Location = New Point(12, 125)
LabelLimit.Location = New Point(19, 137)
LabelLimit.Name = "LabelLimit"
LabelLimit.Size = New Size(56, 23)
LabelLimit.TabIndex = 12
LabelLimit.Text = "Limit"
LabelLimit.Text = "Limit:"
'
' LabelListing
'
LabelListing.AutoEllipsis = True
LabelListing.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Bold Or FontStyle.Underline, GraphicsUnit.Point)
LabelListing.ForeColor = Color.Black
LabelListing.Location = New Point(12, 157)
LabelListing.Location = New Point(19, 168)
LabelListing.Name = "LabelListing"
LabelListing.Size = New Size(56, 23)
LabelListing.TabIndex = 13
LabelListing.Text = "Listing"
LabelListing.Text = "Listing:"
'
' LabelTimeframe
'
LabelTimeframe.AutoEllipsis = True
LabelTimeframe.Font = New Font("Segoe UI Semibold", 9F, FontStyle.Bold Or FontStyle.Underline, GraphicsUnit.Point)
LabelTimeframe.ForeColor = Color.Black
LabelTimeframe.Location = New Point(12, 191)
LabelTimeframe.Location = New Point(19, 200)
LabelTimeframe.Name = "LabelTimeframe"
LabelTimeframe.Size = New Size(71, 23)
LabelTimeframe.Size = New Size(81, 23)
LabelTimeframe.TabIndex = 14
LabelTimeframe.Text = "Timeframe"
LabelTimeframe.Text = "Timeframe:"
'
' ContextMenuStrip1
' ContextMenuStripRightClick
'
ContextMenuStrip1.Items.AddRange(New ToolStripItem() {SaveResultsStripMenuItem, DarkModeToolStripMenuItem})
ContextMenuStrip1.Name = "ContextMenuStrip1"
ContextMenuStrip1.Size = New Size(144, 48)
ContextMenuStripRightClick.Items.AddRange(New ToolStripItem() {ToolStripMenuItemDarkMode, ToolStripMenuItemSavePosts, ToolStripMenuItemAbout, ToolStripMenuItemDeveloper, ToolStripMenuItemCheckUpdates, ToolStripMenuItemQuit})
ContextMenuStripRightClick.Name = "ContextMenuStrip1"
ContextMenuStripRightClick.Size = New Size(154, 136)
'
' SaveResultsStripMenuItem
' ToolStripMenuItemDarkMode
'
SaveResultsStripMenuItem.AutoToolTip = True
SaveResultsStripMenuItem.DropDownItems.AddRange(New ToolStripItem() {JSONToolStripMenuItem, CSVToolStripMenuItem})
SaveResultsStripMenuItem.Image = CType(resources.GetObject("SaveResultsStripMenuItem.Image"), Image)
SaveResultsStripMenuItem.Name = "SaveResultsStripMenuItem"
SaveResultsStripMenuItem.Size = New Size(143, 22)
SaveResultsStripMenuItem.Text = "Save posts to"
ToolStripMenuItemDarkMode.AutoToolTip = True
ToolStripMenuItemDarkMode.CheckOnClick = True
ToolStripMenuItemDarkMode.Image = CType(resources.GetObject("ToolStripMenuItemDarkMode.Image"), Image)
ToolStripMenuItemDarkMode.Name = "ToolStripMenuItemDarkMode"
ToolStripMenuItemDarkMode.Size = New Size(153, 22)
ToolStripMenuItemDarkMode.Text = "Dark Mode"
'
' JSONToolStripMenuItem
' ToolStripMenuItemSavePosts
'
JSONToolStripMenuItem.AutoToolTip = True
JSONToolStripMenuItem.CheckOnClick = True
JSONToolStripMenuItem.Image = CType(resources.GetObject("JSONToolStripMenuItem.Image"), Image)
JSONToolStripMenuItem.Name = "JSONToolStripMenuItem"
JSONToolStripMenuItem.Size = New Size(185, 22)
JSONToolStripMenuItem.Text = "JSON"
ToolStripMenuItemSavePosts.AutoToolTip = True
ToolStripMenuItemSavePosts.DropDownItems.AddRange(New ToolStripItem() {ToolStripMenuItemtoJSON, ToolStripMenuItemtoCSV})
ToolStripMenuItemSavePosts.Image = CType(resources.GetObject("ToolStripMenuItemSavePosts.Image"), Image)
ToolStripMenuItemSavePosts.Name = "ToolStripMenuItemSavePosts"
ToolStripMenuItemSavePosts.Size = New Size(153, 22)
ToolStripMenuItemSavePosts.Text = "Save Posts"
ToolStripMenuItemSavePosts.ToolTipText = "Save found posts to..."
'
' CSVToolStripMenuItem
' ToolStripMenuItemtoJSON
'
CSVToolStripMenuItem.AutoToolTip = True
CSVToolStripMenuItem.Enabled = False
CSVToolStripMenuItem.Image = CType(resources.GetObject("CSVToolStripMenuItem.Image"), Image)
CSVToolStripMenuItem.Name = "CSVToolStripMenuItem"
CSVToolStripMenuItem.Size = New Size(185, 22)
CSVToolStripMenuItem.Text = "CSV (coming soon...)"
ToolStripMenuItemtoJSON.AutoToolTip = True
ToolStripMenuItemtoJSON.CheckOnClick = True
ToolStripMenuItemtoJSON.Image = CType(resources.GetObject("ToolStripMenuItemtoJSON.Image"), Image)
ToolStripMenuItemtoJSON.Name = "ToolStripMenuItemtoJSON"
ToolStripMenuItemtoJSON.Size = New Size(116, 22)
ToolStripMenuItemtoJSON.Text = "to JSON"
'
' DarkModeToolStripMenuItem
' ToolStripMenuItemtoCSV
'
DarkModeToolStripMenuItem.AutoToolTip = True
DarkModeToolStripMenuItem.CheckOnClick = True
DarkModeToolStripMenuItem.Image = CType(resources.GetObject("DarkModeToolStripMenuItem.Image"), Image)
DarkModeToolStripMenuItem.Name = "DarkModeToolStripMenuItem"
DarkModeToolStripMenuItem.Size = New Size(143, 22)
DarkModeToolStripMenuItem.Text = "Dark mode"
ToolStripMenuItemtoCSV.AutoToolTip = True
ToolStripMenuItemtoCSV.Enabled = False
ToolStripMenuItemtoCSV.Image = CType(resources.GetObject("ToolStripMenuItemtoCSV.Image"), Image)
ToolStripMenuItemtoCSV.Name = "ToolStripMenuItemtoCSV"
ToolStripMenuItemtoCSV.Size = New Size(116, 22)
ToolStripMenuItemtoCSV.Text = "to CSV"
'
' FileMenuStrip
' ToolStripMenuItemAbout
'
FileMenuStrip.BackColor = Color.Transparent
FileMenuStrip.Items.AddRange(New ToolStripItem() {ToolsToolStripMenuTools})
FileMenuStrip.Location = New Point(0, 0)
FileMenuStrip.Name = "FileMenuStrip"
FileMenuStrip.Size = New Size(355, 24)
FileMenuStrip.TabIndex = 0
FileMenuStrip.Text = "MenuStrip1"
ToolStripMenuItemAbout.AutoToolTip = True
ToolStripMenuItemAbout.Image = CType(resources.GetObject("ToolStripMenuItemAbout.Image"), Image)
ToolStripMenuItemAbout.Name = "ToolStripMenuItemAbout"
ToolStripMenuItemAbout.Size = New Size(153, 22)
ToolStripMenuItemAbout.Text = "About"
'
' ToolsToolStripMenuTools
' ToolStripMenuItemDeveloper
'
ToolsToolStripMenuTools.DropDownItems.AddRange(New ToolStripItem() {AboutToolStripMenuItem, DeveloperToolStripMenuItem, CheckUpdatesToolStripMenuItem, ToolStripSeparator2, QuitToolStripMenuItem})
ToolsToolStripMenuTools.Font = New Font("Segoe UI", 9F, FontStyle.Regular, GraphicsUnit.Point)
ToolsToolStripMenuTools.ForeColor = Color.White
ToolsToolStripMenuTools.Image = CType(resources.GetObject("ToolsToolStripMenuTools.Image"), Image)
ToolsToolStripMenuTools.Name = "ToolsToolStripMenuTools"
ToolsToolStripMenuTools.Size = New Size(28, 20)
ToolStripMenuItemDeveloper.AutoToolTip = True
ToolStripMenuItemDeveloper.Image = CType(resources.GetObject("ToolStripMenuItemDeveloper.Image"), Image)
ToolStripMenuItemDeveloper.Name = "ToolStripMenuItemDeveloper"
ToolStripMenuItemDeveloper.Size = New Size(153, 22)
ToolStripMenuItemDeveloper.Text = "Developer"
'
' AboutToolStripMenuItem
' ToolStripMenuItemCheckUpdates
'
AboutToolStripMenuItem.AutoToolTip = True
AboutToolStripMenuItem.Image = CType(resources.GetObject("AboutToolStripMenuItem.Image"), Image)
AboutToolStripMenuItem.Name = "AboutToolStripMenuItem"
AboutToolStripMenuItem.Size = New Size(152, 22)
AboutToolStripMenuItem.Text = "About"
ToolStripMenuItemCheckUpdates.AutoToolTip = True
ToolStripMenuItemCheckUpdates.Image = CType(resources.GetObject("ToolStripMenuItemCheckUpdates.Image"), Image)
ToolStripMenuItemCheckUpdates.Name = "ToolStripMenuItemCheckUpdates"
ToolStripMenuItemCheckUpdates.Size = New Size(153, 22)
ToolStripMenuItemCheckUpdates.Text = "Check Updates"
'
' DeveloperToolStripMenuItem
' ToolStripMenuItemQuit
'
DeveloperToolStripMenuItem.AutoToolTip = True
DeveloperToolStripMenuItem.Image = CType(resources.GetObject("DeveloperToolStripMenuItem.Image"), Image)
DeveloperToolStripMenuItem.Name = "DeveloperToolStripMenuItem"
DeveloperToolStripMenuItem.Size = New Size(152, 22)
DeveloperToolStripMenuItem.Text = "Developer"
'
' CheckUpdatesToolStripMenuItem
'
CheckUpdatesToolStripMenuItem.AutoToolTip = True
CheckUpdatesToolStripMenuItem.Image = CType(resources.GetObject("CheckUpdatesToolStripMenuItem.Image"), Image)
CheckUpdatesToolStripMenuItem.Name = "CheckUpdatesToolStripMenuItem"
CheckUpdatesToolStripMenuItem.Size = New Size(152, 22)
CheckUpdatesToolStripMenuItem.Text = "Check updates"
'
' ToolStripSeparator2
'
ToolStripSeparator2.Name = "ToolStripSeparator2"
ToolStripSeparator2.Size = New Size(149, 6)
'
' QuitToolStripMenuItem
'
QuitToolStripMenuItem.AutoToolTip = True
QuitToolStripMenuItem.Image = CType(resources.GetObject("QuitToolStripMenuItem.Image"), Image)
QuitToolStripMenuItem.Name = "QuitToolStripMenuItem"
QuitToolStripMenuItem.Size = New Size(152, 22)
QuitToolStripMenuItem.Text = "Quit"
ToolStripMenuItemQuit.AutoToolTip = True
ToolStripMenuItemQuit.Image = CType(resources.GetObject("ToolStripMenuItemQuit.Image"), Image)
ToolStripMenuItemQuit.Name = "ToolStripMenuItemQuit"
ToolStripMenuItemQuit.Size = New Size(153, 22)
ToolStripMenuItemQuit.Text = "Quit"
'
' LimitNumericUpDown
'
LimitNumericUpDown.Location = New Point(89, 125)
LimitNumericUpDown.Location = New Point(159, 137)
LimitNumericUpDown.Minimum = New Decimal(New Integer() {5, 0, 0, 0})
LimitNumericUpDown.Name = "LimitNumericUpDown"
LimitNumericUpDown.ReadOnly = True
@@ -263,43 +238,64 @@ Partial Class StartForm
LimitNumericUpDown.TabIndex = 15
LimitNumericUpDown.Value = New Decimal(New Integer() {10, 0, 0, 0})
'
' PictureBoxLogo
'
PictureBoxLogo.BackColor = Color.Transparent
PictureBoxLogo.Image = CType(resources.GetObject("PictureBoxLogo.Image"), Image)
PictureBoxLogo.Location = New Point(19, 12)
PictureBoxLogo.Name = "PictureBoxLogo"
PictureBoxLogo.Size = New Size(41, 45)
PictureBoxLogo.SizeMode = PictureBoxSizeMode.StretchImage
PictureBoxLogo.TabIndex = 17
PictureBoxLogo.TabStop = False
'
' LabelRPST
'
LabelRPST.AutoSize = True
LabelRPST.BackColor = Color.Transparent
LabelRPST.Font = New Font("Ink Free", 9F, FontStyle.Regular, GraphicsUnit.Point)
LabelRPST.Location = New Point(50, 51)
LabelRPST.Name = "LabelRPST"
LabelRPST.Size = New Size(36, 15)
LabelRPST.TabIndex = 18
LabelRPST.Text = "RPST"
'
' StartForm
'
AutoScaleDimensions = New SizeF(7F, 15F)
AutoScaleMode = AutoScaleMode.Font
BackColor = SystemColors.Control
ClientSize = New Size(355, 255)
ContextMenuStrip = ContextMenuStrip1
Controls.Add(LimitNumericUpDown)
Controls.Add(FileMenuStrip)
ClientSize = New Size(281, 244)
ContextMenuStrip = ContextMenuStripRightClick
Controls.Add(LabelRPST)
Controls.Add(PictureBoxLogo)
Controls.Add(TimeframeComboBox)
Controls.Add(KeywordTextBox)
Controls.Add(LabelTimeframe)
Controls.Add(LabelListing)
Controls.Add(LabelLimit)
Controls.Add(LabelSubreddit)
Controls.Add(LabelKeyword)
Controls.Add(ListingComboBox)
Controls.Add(TimeframeComboBox)
Controls.Add(LimitNumericUpDown)
Controls.Add(LabelListing)
Controls.Add(ButtonScrape)
Controls.Add(LabelLimit)
Controls.Add(LabelSubreddit)
Controls.Add(SubredditTextBox)
Controls.Add(ScrapeButton)
Controls.Add(KeywordTextBox)
FormBorderStyle = FormBorderStyle.FixedSingle
Icon = CType(resources.GetObject("$this.Icon"), Icon)
MainMenuStrip = FileMenuStrip
MaximizeBox = False
Name = "StartForm"
StartPosition = FormStartPosition.CenterScreen
Text = "ProgramName ProgramVersion"
ContextMenuStrip1.ResumeLayout(False)
FileMenuStrip.ResumeLayout(False)
FileMenuStrip.PerformLayout()
ContextMenuStripRightClick.ResumeLayout(False)
CType(LimitNumericUpDown, ComponentModel.ISupportInitialize).EndInit()
CType(PictureBoxLogo, ComponentModel.ISupportInitialize).EndInit()
ResumeLayout(False)
PerformLayout()
End Sub
Friend WithEvents KeywordTextBox As TextBox
Friend WithEvents SubredditTextBox As TextBox
Friend WithEvents ScrapeButton As Button
Friend WithEvents ButtonScrape As Button
Friend WithEvents TimeframeComboBox As ComboBox
Friend WithEvents ListingComboBox As ComboBox
Friend WithEvents LabelKeyword As Label
@@ -307,18 +303,16 @@ Partial Class StartForm
Friend WithEvents LabelLimit As Label
Friend WithEvents LabelListing As Label
Friend WithEvents LabelTimeframe As Label
Friend WithEvents ContextMenuStrip1 As ContextMenuStrip
Friend WithEvents FileMenuStrip As MenuStrip
Friend WithEvents ToolsToolStripMenuTools As ToolStripMenuItem
Friend WithEvents AboutToolStripMenuItem As ToolStripMenuItem
Friend WithEvents DeveloperToolStripMenuItem As ToolStripMenuItem
Friend WithEvents ToolStripSeparator2 As ToolStripSeparator
Friend WithEvents QuitToolStripMenuItem As ToolStripMenuItem
Friend WithEvents SaveResultsStripMenuItem As ToolStripMenuItem
Friend WithEvents CheckUpdatesToolStripMenuItem As ToolStripMenuItem
Friend WithEvents JSONToolStripMenuItem As ToolStripMenuItem
Friend WithEvents CSVToolStripMenuItem As ToolStripMenuItem
Friend WithEvents ContextMenuStripRightClick As ContextMenuStrip
Friend WithEvents ToolStripMenuItemSavePosts As ToolStripMenuItem
Friend WithEvents ToolStripMenuItemtoJSON As ToolStripMenuItem
Friend WithEvents ToolStripMenuItemtoCSV As ToolStripMenuItem
Friend WithEvents LimitNumericUpDown As NumericUpDown
Friend WithEvents DarkModeToolStripMenuItem As ToolStripMenuItem
Friend WithEvents ToolTip1 As ToolTip
Friend WithEvents ToolStripMenuItemDarkMode As ToolStripMenuItem
Friend WithEvents ToolStripMenuItemAbout As ToolStripMenuItem
Friend WithEvents ToolStripMenuItemDeveloper As ToolStripMenuItem
Friend WithEvents ToolStripMenuItemCheckUpdates As ToolStripMenuItem
Friend WithEvents ToolStripMenuItemQuit As ToolStripMenuItem
Friend WithEvents PictureBoxLogo As PictureBox
Friend WithEvents LabelRPST As Label
End Class

File diff suppressed because it is too large Load Diff

View File

@@ -13,8 +13,8 @@ Public Class StartForm
''' </summary>
''' <param name="sender">The sender of the event.</param>
''' <param name="e">The EventArgs instance containing the event data.</param>
Private Sub ScrapeButton_Click(sender As Object, e As EventArgs) Handles ScrapeButton.Click
Utilities.ProcessRedditPosts(JSONToolStripMenuItem)
Private Sub ButtonScrape_Click(sender As Object, e As EventArgs) Handles ButtonScrape.Click
Utilities.ProcessRedditPosts(ToolStripMenuItemtoJSON)
End Sub
@@ -29,67 +29,7 @@ Public Class StartForm
settings.ToggleDarkMode(settings.DarkMode)
Utilities.PathFinder()
Utilities.LogFirstTimeLaunch()
Me.Text = My.Application.Info.AssemblyName
End Sub
''' <summary>
''' Event handler for the 'About' menu item click.
''' It shows the 'About' box.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">An EventArgs that contains the event data.</param>
Private Sub AboutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AboutToolStripMenuItem.Click
AboutBox.Show()
End Sub
''' <summary>
''' Event handler for the 'Quit' menu item click.
''' It asks the user for confirmation and closes the program if the user agrees.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">An EventArgs that contains the event data.</param>
Private Sub QuitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles QuitToolStripMenuItem.Click
Dim result As DialogResult = MessageBox.Show("This will close the program, continue?", "Quit", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = DialogResult.Yes Then
Me.Close()
End If
End Sub
''' <summary>
''' Event handler for the 'Developer' menu item click.
''' It shows the 'Developer' dialog box.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">An EventArgs that contains the event data.</param>
Private Sub DeveloperToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DeveloperToolStripMenuItem.Click
DeveloperForm.ShowDialog()
End Sub
''' <summary>
''' Event handler for the 'Check Updates' menu item click.
''' It checks for application updates and provides update information if a newer version is available.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">An EventArgs that contains the event data.</param>
Private Sub CheckUpdatesToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CheckUpdatesToolStripMenuItem.Click
Dim data As JObject = ApiHandler.CheckUpdates()
If data("tag_name").ToString = $"{My.Application.Info.Version}" Then
MessageBox.Show($"You're running the current version v{My.Application.Info.Version} of {My.Application.Info.ProductName}. Check again soon! :)", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
Dim confirm As DialogResult = MessageBox.Show($"A new version v{data("tag_name")} of {My.Application.Info.ProductName} is available, would you like to get it?
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/bellingcat/reddit-post-scraping-tool/releases/tag/{data("tag_name")}")
End If
End If
Me.Text = $"{My.Application.Info.AssemblyName} v{My.Application.Info.Version}"
End Sub
@@ -99,7 +39,65 @@ What's new in v{data("tag_name")}?
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">An EventArgs that contains the event data.</param>
Private Sub DarkModeToolStripMenuItem_CheckedChanged(sender As Object, e As EventArgs) Handles DarkModeToolStripMenuItem.CheckedChanged
settings.ToggleDarkMode(DarkModeToolStripMenuItem.Checked)
Private Sub DarkModeToolStripMenuItem_CheckedChanged(sender As Object, e As EventArgs) Handles ToolStripMenuItemDarkMode.CheckedChanged
settings.ToggleDarkMode(ToolStripMenuItemDarkMode.Checked)
End Sub
''' <summary>
''' Event handler for the 'About' menu item click.
''' It shows the 'About' box.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">An EventArgs that contains the event data.</param>
Private Sub ToolStripMenuItemAbout_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItemAbout.Click
AboutBox.Show()
End Sub
''' <summary>
''' Event handler for the 'Developer' menu item click.
''' It shows the 'Developer' dialog box.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">An EventArgs that contains the event data.</param>
Private Sub ToolStripMenuItemDeveloper_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItemDeveloper.Click
DeveloperBox.ShowDialog()
End Sub
''' <summary>
''' Event handler for the 'Check Updates' menu item click.
''' It checks for application updates and provides update information if a newer version is available.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">An EventArgs that contains the event data.</param>
Private Sub ToolStripMenuItemCheckUpdates_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItemCheckUpdates.Click
Dim data As JObject = ApiHandler.CheckUpdates()
If data("tag_name").ToString = $"{My.Application.Info.Version}" Then
MessageBox.Show($"You're running the current version v{My.Application.Info.Version} of {My.Application.Info.ProductName}. Check again soon! :)", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
Dim confirm As DialogResult = MessageBox.Show($"A new version v{data("tag_name")} of {My.Application.Info.ProductName} is available, would you like to get it?
{data("body")}
", "Update", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If confirm = DialogResult.Yes Then
Shell($"cmd /c start {data("html_url")}")
End If
End If
End Sub
''' <summary>
''' Event handler for the 'Quit' menu item click.
''' It asks the user for confirmation and closes the program if the user agrees.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">An EventArgs that contains the event data.</param>
Private Sub ToolStripMenuItemQuit_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItemQuit.Click
Dim result As DialogResult = MessageBox.Show("This will close the program, continue?", "Quit", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = DialogResult.Yes Then
Me.Close()
End If
End Sub
End Class

View File

@@ -17,7 +17,7 @@ Public Class Utilities
If inputs.HasValue Then
' Initialize the DataGridView
DataGridViewHandler.AddColumn(PostsForm.DataGridViewPosts)
DataGridViewHandler.AddColumn(ResultsForm.DataGridViewResults)
' Fetch Reddit posts based on the inputs
Dim processor As New PostsProcessor()
@@ -29,17 +29,17 @@ Public Class Utilities
For Each post In posts("data")("children")
totalPosts += 1
' Check if the post contains the keyword
If PostsProcessor.PostContainsKeyword(post, inputs.Value.Keyword.ToLower(System.Globalization.CultureInfo.InvariantCulture)) Then
If PostsProcessor.PostContainsKeyword(post, inputs.Value.Keyword.ToLower(Globalization.CultureInfo.InvariantCulture)) Then
' Add the post to the DataGridView
DataGridViewHandler.AddRow(PostsForm.DataGridViewPosts, post, totalPosts)
PostsForm.Show()
DataGridViewHandler.AddRow(ResultsForm.DataGridViewResults, post, totalPosts)
ResultsForm.Show()
keywordFound = True
End If
Next
' Check if the keyword was found in any posts
If Not keywordFound Then
MessageBox.Show($"Keyword `{inputs.Value.Keyword}` was not found in any of the " + posts("data")("children").Count.ToString(System.Globalization.CultureInfo.InvariantCulture) _
MessageBox.Show($"Keyword `{inputs.Value.Keyword}` was not found in any of the " + posts("data")("children").Count.ToString(Globalization.CultureInfo.InvariantCulture) _
+ $" {inputs.Value.Listing} posts from r/{inputs.Value.Subreddit}", "Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If
@@ -48,7 +48,6 @@ Public Class Utilities
Utilities.SavePostsToJson(posts("data"))
End If
Else
MessageBox.Show("Inputs cannot be empty. Please enter a keyword and a subreddit.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Sub
@@ -88,25 +87,22 @@ Public Class Utilities
Public Shared Function CollectInputs() As (Keyword As String, Subreddit As String, Listing As String, Limit As Integer, Timeframe As String)?
Dim keyword As String = StartForm.KeywordTextBox.Text.Trim()
Dim subreddit As String = StartForm.SubredditTextBox.Text.Trim()
' Convert the Keyword and Subreddit to lowercase using InvariantCulture
Dim listing As String = If(String.IsNullOrEmpty(StartForm.ListingComboBox.Text), "top", StartForm.ListingComboBox.Text.ToLower(System.Globalization.CultureInfo.InvariantCulture).Trim())
' Convert the Listing and Subreddit to lowercase using InvariantCulture
Dim listing As String = If(String.IsNullOrEmpty(StartForm.ListingComboBox.Text), "top", StartForm.ListingComboBox.Text.ToLower(Globalization.CultureInfo.InvariantCulture).Trim())
Dim timeframe As String = If(String.IsNullOrEmpty(StartForm.TimeframeComboBox.Text), "all", StartForm.TimeframeComboBox.Text.ToLower(Globalization.CultureInfo.InvariantCulture).Trim())
Dim limit As Integer = StartForm.LimitNumericUpDown.Value
Dim timeframe As String = If(String.IsNullOrEmpty(StartForm.TimeframeComboBox.Text), "all", StartForm.TimeframeComboBox.Text.ToLower(System.Globalization.CultureInfo.InvariantCulture).Trim())
' Validate inputs
If String.IsNullOrEmpty(keyword) Then
MessageBox.Show("Keyword should not be empty", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
If String.IsNullOrEmpty(keyword) AndAlso String.IsNullOrEmpty(subreddit) Then
MessageBox.Show("Keyword and Subreddit fields should not be empty.", "Invalid Inputs", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Return Nothing
ElseIf String.IsNullOrEmpty(keyword) Then
MessageBox.Show("Keyword field should not be empty.", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Return Nothing
ElseIf String.IsNullOrEmpty(subreddit) Then
MessageBox.Show("Subreddit field should not be empty.", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Return Nothing
End If
If String.IsNullOrEmpty(subreddit) Then
MessageBox.Show("Subreddit should not be empty", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Return Nothing
End If
If limit > 100 Then
MessageBox.Show("Limit should not be over 100. Defaulting to 10", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
limit = 10
End If
Return (keyword, subreddit, listing, limit, timeframe)
End Function
@@ -174,7 +170,6 @@ First launched on: {DateTime.Now}"
LicenseNotice()
File.WriteAllText(filePath, textToWrite)
Else
' DO NOTHING
End If
End Sub
End Class

View File

@@ -7,7 +7,7 @@ packages = ["rpst"]
[project]
name = "reddit-post-scraping-tool"
version = "1.4.1.0"
version = "1.5.0.0"
description = "Given a subreddit name and a keyword, RPST returns all top (by default) posts that contain the specified keyword."
readme = "README.md"
requires-python = ">=3.8"

View File

@@ -17,7 +17,7 @@ def run():
try:
# Check for updates
check_updates(version_tag="1.4.1.0")
check_updates(version_tag="1.5.0.0")
# Get posts with the provided/parsed arguments
get_posts(arguments=arguments)