Skip to content

Commit

Permalink
Merge pull request #21 from edge20200/PullUpdates
Browse files Browse the repository at this point in the history
Pull updates
  • Loading branch information
edge20200 authored Sep 5, 2024
2 parents 1b23515 + 9a9ba56 commit 570c8f5
Show file tree
Hide file tree
Showing 9 changed files with 619 additions and 413 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ A simple tool to take the work out of uploading.

## Coming Soon:
- Features

- Rebase

## **Setup:**
- **REQUIRES AT LEAST PYTHON 3.12 AND PIP3**
Expand Down
2 changes: 1 addition & 1 deletion data/example-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
"announce_url": "https://hdbits.org/announce/Custom_Announce_URL",
"anon": False,
},
"MANUAL" : {
"MANUAL": {
# Uncomment and replace link with filebrowser (https://github.com/filebrowser/filebrowser) link to the Upload-Assistant directory, this will link to your filebrowser instead of uploading to uguu.se
# "filebrowser" : "https://domain.tld/filebrowser/files/Upload-Assistant/"
},
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ rich
Jinja2
pyotp
str2bool
click
click
aiohttp
Pillow
28 changes: 28 additions & 0 deletions src/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def parse(self, args, meta):
parser.add_argument('-year', '--year', dest='manual_year', nargs='?', required=False, help="Year", type=int, default=0)
parser.add_argument('-ptp', '--ptp', nargs='*', required=False, help="PTP torrent id/permalink", type=str)
parser.add_argument('-blu', '--blu', nargs='*', required=False, help="BLU torrent id/link", type=str)
parser.add_argument('-aither', '--aither', nargs='*', required=False, help="Aither torrent id/link", type=str)
parser.add_argument('-lst', '--lst', nargs='*', required=False, help="LST torrent id/link", type=str)
parser.add_argument('-hdb', '--hdb', nargs='*', required=False, help="HDB torrent id/link", type=str)
parser.add_argument('-d', '--desc', nargs='*', required=False, help="Custom Description (string)")
parser.add_argument('-pb', '--desclink', nargs='*', required=False, help="Custom Description (link to hastebin/pastebin)")
Expand Down Expand Up @@ -137,6 +139,32 @@ def parse(self, args, meta):
console.print('[red]Continuing without --blu')
else:
meta['blu'] = value2
elif key == 'aither':
if value2.startswith('http'):
parsed = urllib.parse.urlparse(value2)
try:
aitherpath = parsed.path
if aitherpath.endswith('/'):
aitherpath = aitherpath[:-1]
meta['aither'] = aitherpath.split('/')[-1]
except Exception:
console.print('[red]Unable to parse id from url')
console.print('[red]Continuing without --aither')
else:
meta['aither'] = value2
elif key == 'lst':
if value2.startswith('http'):
parsed = urllib.parse.urlparse(value2)
try:
lstpath = parsed.path
if lstpath.endswith('/'):
lstpath = lstpath[:-1]
meta['lst'] = lstpath.split('/')[-1]
except Exception:
console.print('[red]Unable to parse id from url')
console.print('[red]Continuing without --lst')
else:
meta['lst'] = value2
elif key == 'hdb':
if value2.startswith('http'):
parsed = urllib.parse.urlparse(value2)
Expand Down
12 changes: 10 additions & 2 deletions src/bbcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def clean_unit3d_description(self, desc, site):
# Filter out bot images from imagelist
bot_image_urls = [
"https://blutopia.xyz/favicon.ico", # Example bot image URL
"https://i.ibb.co/2NVWb0c/uploadrr.webp",
# Add any other known bot image URLs here
]
imagelist = [img for img in imagelist if img['img_url'] not in bot_image_urls]
Expand All @@ -224,8 +225,15 @@ def clean_unit3d_description(self, desc, site):
desc = desc.replace(center, cleaned_center.strip())

# Remove bot signatures
bot_signature_regex = r"\[center\]\s*\[img=\d+\]https:\/\/blutopia\.xyz\/favicon\.ico\[\/img\]\s*\[b\]Uploaded Using \[url=https:\/\/github\.com\/HDInnovations\/UNIT3D\]UNIT3D\[\/url\] Auto Uploader\[\/b\]\s*\[img=\d+\]https:\/\/blutopia\.xyz\/favicon\.ico\[\/img\]\s*\[\/center\]"
desc = re.sub(bot_signature_regex, "", desc, flags=re.IGNORECASE)
bot_signature_regex = r"""
\[center\]\s*\[img=\d+\]https:\/\/blutopia\.xyz\/favicon\.ico\[\/img\]\s*\[b\]
Uploaded\sUsing\s\[url=https:\/\/github\.com\/HDInnovations\/UNIT3D\]UNIT3D\[\/url\]\s
Auto\sUploader\[\/b\]\s*\[img=\d+\]https:\/\/blutopia\.xyz\/favicon\.ico\[\/img\]\s*\[\/center\]|
\[center\]\s*\[b\]Uploaded\sUsing\s\[url=https:\/\/github\.com\/HDInnovations\/UNIT3D\]UNIT3D\[\/url\]
\sAuto\sUploader\[\/b\]\s*\[\/center\]|
\[center\]\[url=https:\/\/github\.com\/z-ink\/uploadrr\]\[img=\d+\]https:\/\/i\.ibb\.co\/2NVWb0c\/uploadrr\.webp\[\/img\]\[\/url\]\[\/center\]
"""
desc = re.sub(bot_signature_regex, "", desc, flags=re.IGNORECASE | re.VERBOSE)
desc = re.sub(r"\[center\].*Created by L4G's Upload Assistant.*\[\/center\]", "", desc, flags=re.IGNORECASE)

# Ensure no dangling tags and remove extra blank lines
Expand Down
Loading

0 comments on commit 570c8f5

Please sign in to comment.