Skip to content

Commit

Permalink
Merge pull request #61 from bellingcat/dev
Browse files Browse the repository at this point in the history
dev -> 3.4.0.0
  • Loading branch information
rly0nheart committed Dec 22, 2023
2 parents 3812555 + 448fc75 commit 60471fc
Show file tree
Hide file tree
Showing 16 changed files with 132 additions and 231 deletions.
2 changes: 1 addition & 1 deletion Knew Karma GUI/KnewKarma/Handlers/ApiHandler.vb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Public Class ApiHandler
Using httpClient As New HttpClient()
httpClient.DefaultRequestHeaders.Add(
"User-Agent",
$"Knew-Karma/{appVersion} ({dotNetVersion}; +https://about.me/rly0nheart)"
$"Knew-Karma/{appVersion} ({dotNetVersion}; +https://rly0nheart.github.io)"
)

Dim response As HttpResponseMessage = Await httpClient.GetAsync(endpoint)
Expand Down
8 changes: 4 additions & 4 deletions Knew Karma GUI/KnewKarma/KnewKarma.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
<Company>Richard Mwewa</Company>
<Description>A Reddit Data Analysis Toolkit.</Description>
<Copyright>© 2023 Richard Mwewa. All rights reserved.</Copyright>
<PackageProjectUrl>https://github.com/bellingcat/knewkarma/wiki</PackageProjectUrl>
<PackageProjectUrl>https://github.com/bellingcat/knewkarma</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/bellingcat/knewkarma</RepositoryUrl>
<AssemblyVersion>3.3.0.0</AssemblyVersion>
<FileVersion>3.3.0.0</FileVersion>
<AssemblyVersion>3.4.0.0</AssemblyVersion>
<FileVersion>3.4.0.0</FileVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<Version>3.3.0</Version>
<Version>3.4.0</Version>
<PackageTags>reddit;scraper;reddit-scraper;osint;reddit-data</PackageTags>
<PackageReleaseNotes></PackageReleaseNotes>
<AnalysisLevel>6.0-recommended</AnalysisLevel>
Expand Down
6 changes: 3 additions & 3 deletions Knew Karma GUI/KnewKarma/My Project/Application.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Knew Karma GUI/KnewKarma/My Project/Application.myapp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-16"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>Form1</MainForm>
<MainForm>MainWindow</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
<SplashScreen>SplashScreen</SplashScreen>
<SplashScreen></SplashScreen>
<MinimumSplashScreenDisplayTime>2000</MinimumSplashScreenDisplayTime>
</MyApplicationData>
2 changes: 1 addition & 1 deletion Knew Karma GUI/KnewKarma/Windows/AboutWindow.vb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
''' <param name="sender">The source of the event.</param>
''' <param name="e">The event data.</param>
Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles Copyright.LinkClicked, Copyright.LinkClicked
Shell("cmd.exe /c start https://about.me/rly0nheart")
Shell("cmd.exe /c start https://rly0nheart.github.io")
End Sub

Private Sub ButtonCheckforUpdates_Click(sender As Object, e As EventArgs) Handles ButtonGetUpdates.Click
Expand Down
8 changes: 4 additions & 4 deletions Knew Karma GUI/KnewKarmaSetup/KnewKarmaSetup.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,15 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Knew Karma"
"ProductCode" = "8:{EC317D6E-D0D6-4C8B-9120-59D6F8AE1626}"
"PackageCode" = "8:{5A52E59B-8C23-4400-8D0F-851C28E3DADA}"
"ProductCode" = "8:{54746087-7636-4C00-845D-253E0D22CBA6}"
"PackageCode" = "8:{64395976-B1A2-4CBC-95D0-0AC31AA608D1}"
"UpgradeCode" = "8:{9B03AD0F-0C14-4075-AB75-01CD38A594B4}"
"AspNetVersion" = "8:2.0.50727.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:3.3.0"
"ProductVersion" = "8:3.4.0"
"Manufacturer" = "8:Richard Mwewa"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:https://github.com/bellingcat/knewkarma/wiki"
Expand All @@ -246,7 +246,7 @@
"ARPCONTACT" = "8:Richard Mwewa"
"Keywords" = "8:reddit;scraper;reddit-scraper;osint;reddit-data"
"ARPCOMMENTS" = "8:Reddit Data Analysis Toolkit."
"ARPURLINFOABOUT" = "8:https://about.me/rly0nheart"
"ARPURLINFOABOUT" = "8:https://rly0nheart.github.io"
"ARPPRODUCTICON" = "8:_74130F0CE3BE422EBBC67E9C538BCD01"
"ARPIconIndex" = "3:0"
"SearchPath" = "8:"
Expand Down
29 changes: 0 additions & 29 deletions examples/posts.py

This file was deleted.

41 changes: 0 additions & 41 deletions examples/subreddit.py

This file was deleted.

42 changes: 0 additions & 42 deletions examples/user.py

This file was deleted.

44 changes: 19 additions & 25 deletions knewkarma/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #


async def setup_cli(arguments: argparse.Namespace):
async def stage_cli(arguments: argparse.Namespace):
"""
Sets up the command-line interface and executes the specified actions.
Expand Down Expand Up @@ -126,45 +126,39 @@ async def setup_cli(arguments: argparse.Namespace):
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #


def execute():
def run_cli():
"""Main entrypoint for the Knew Karma command-line interface."""

# -------------------------------------------------------------------- #

parser = create_parser()
arguments: argparse = parser.parse_args()
arguments: argparse = create_parser().parse_args()
start_time: datetime = datetime.now()

# -------------------------------------------------------------------- #

if arguments.mode:
print(
"""
print(
"""
┓┏┓ ┓┏┓
┃┫ ┏┓┏┓┓┏┏ ┃┫ ┏┓┏┓┏┳┓┏┓
┛┗┛┛┗┗ ┗┻┛ ┛┗┛┗┻┛ ┛┗┗┗┻"""
)

# -------------------------------------------------------------------- #
)

try:
start_time: datetime = datetime.now()
# -------------------------------------------------------------------- #

log.info(
f"[bold]Knew Karma CLI[/] {version} started at "
f"{start_time.strftime('%a %b %d %Y, %I:%M:%S%p')}..."
)
asyncio.run(setup_cli(arguments=arguments))
except KeyboardInterrupt:
log.warning(f"User interruption detected ([yellow]Ctrl+C[/])")
finally:
log.info(f"Stopped in {datetime.now() - start_time} seconds.")
try:
start_time: datetime = datetime.now()

# -------------------------------------------------------------------- #
log.info(
f"[bold]Knew Karma CLI[/] {version} started at "
f"{start_time.strftime('%a %b %d %Y, %I:%M:%S%p')}..."
)
asyncio.run(stage_cli(arguments=arguments))
except KeyboardInterrupt:
log.warning(f"User interruption detected ([yellow]Ctrl+C[/])")
finally:
log.info(f"Stopped in {datetime.now() - start_time} seconds.")

else:
# Display usage information if no mode is provided
parser.print_usage()
# -------------------------------------------------------------------- #


# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
2 changes: 1 addition & 1 deletion knewkarma/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def create_parser() -> argparse.ArgumentParser:
formatter_class=RichHelpFormatter,
)
subparsers = parser.add_subparsers(
dest="mode", help="operation mode", required=False
dest="mode", help="operation mode", required=True
)
parser.add_argument(
"-l",
Expand Down
16 changes: 14 additions & 2 deletions knewkarma/_project.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #

import os
from typing import Literal

# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #

author: str = "Richard Mwewa"
about_author: str = "https://about.me/rly0nheart"
version: str = "3.3.1.0"
about_author: str = "https://rly0nheart.github.io"
version: str = "3.4.0.0"

# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #

Expand Down Expand Up @@ -95,4 +96,15 @@
# Construct path to the program's directory
PROGRAM_DIRECTORY: str = os.path.expanduser(os.path.join("~", "knewkarma-data"))

DATA_SORT_CRITERION: Literal[
"controversial",
"new",
"top",
"best",
"hot",
"rising",
]

DATA_TIMEFRAME = Literal["hour", "day", "week", "month", "year"]

# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
20 changes: 6 additions & 14 deletions knewkarma/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import aiohttp

from ._coreutils import log
from ._project import version, about_author
from ._project import version, about_author, DATA_SORT_CRITERION, DATA_TIMEFRAME

# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #

Expand Down Expand Up @@ -117,7 +117,7 @@ async def get_updates(session: aiohttp.ClientSession):
if remote_parts[0] != local_parts[0]:
update_message = (
f"[bold][red]MAJOR[/][/] update ({remote_version}) available:"
f" It might introduce significant changes."
f" Introduces significant and important changes."
)

# ---------------------------------------------------------- #
Expand Down Expand Up @@ -161,7 +161,7 @@ async def get_updates(session: aiohttp.ClientSession):
async def get_profile(
profile_source: str,
session: aiohttp.ClientSession,
profile_type: str = Literal["user_profile", "subreddit_profile"],
profile_type: Literal["user_profile", "subreddit_profile"],
) -> dict:
"""
Gets profile data from the specified profile_type and profile_source.
Expand Down Expand Up @@ -194,17 +194,9 @@ async def get_profile(
async def get_posts(
limit: int,
session: aiohttp.ClientSession,
timeframe: str = Literal["all", "hour", "day", "week", "month", "year"],
sort: str = Literal[
"all",
"controversial",
"new",
"top",
"best",
"hot",
"rising",
],
posts_type: str = Literal[
timeframe: DATA_TIMEFRAME,
sort: DATA_SORT_CRITERION,
posts_type: Literal[
"user_posts",
"user_comments",
"subreddit_posts",
Expand Down
Loading

0 comments on commit 60471fc

Please sign in to comment.