Skip to content

Commit

Permalink
Fix database fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
Xpl0itU committed Apr 3, 2024
1 parent 8e49371 commit e3334c9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- name: Install Dependencies
run: |
brew install create-dmg dylibbundler gtk+3
python3 -m pip install requests
- name: Build
run: |
python3 grabTitles.py
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
msystem: UCRT64
release: true
update: true
install: zip git mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-python mingw-w64-ucrt-x86_64-gtk3 mingw-w64-ucrt-x86_64-pkg-config mingw-w64-ucrt-x86_64-go mingw-w64-ucrt-x86_64-ntldd-git
install: zip git mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-python mingw-w64-ucrt-x86_64-gtk3 mingw-w64-ucrt-x86_64-pkg-config mingw-w64-ucrt-x86_64-go mingw-w64-ucrt-x86_64-ntldd-git mingw-w64-ucrt-x86_64-python-requests
- name: Build
run: |
python3 grabTitles.py
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN mkdir -p /usr/share/man/man1 /usr/share/man/man2 && \

RUN apt-fast -y --no-install-recommends update && \
apt-fast -y --no-install-recommends upgrade && \
apt-fast install -y --no-install-recommends build-essential libgcrypt20-dev libgtk-3-dev libfuse2 libtool librsvg2-dev && \
apt-fast install -y --no-install-recommends build-essential libgcrypt20-dev libgtk-3-dev libfuse2 libtool librsvg2-dev python3-requests && \
wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go*.linux-amd64.tar.gz && \
chmod +x /usr/local/go/bin/go* && \
Expand Down
23 changes: 13 additions & 10 deletions grabTitles.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
#!/bin/env python

import os
import urllib.request
import ssl
import requests

# Don't edit below this line


def checkAndDeleteFile(file):
if os.path.exists(file):
print(f"Deleting {file}")
os.remove(file)

# Disable certificate verification
ssl_context = ssl.create_default_context()
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE

opener = urllib.request.build_opener(urllib.request.HTTPSHandler(context=ssl_context))
opener.addheaders = [("User-agent", "NUSspliBuilder/2.2"), ("Accept-Encoding", "gzip, deflate, br")]
urllib.request.install_opener(opener)
def downloadFile(url, file, headers={}):
print(f"Downloading {file}")
with requests.get(url, headers=headers) as r:
with open(file, "wb") as f:
f.write(r.content)


checkAndDeleteFile("db.go")
urllib.request.urlretrieve("https://napi.v10lator.de/db?t=go", "db.go")
downloadFile(
"https://napi.v10lator.de/db?t=go",
"db.go",
{"User-Agent": "NUSspliBuilder/2.2", "Accept-Encoding": "br, gzip, deflate"},
)

0 comments on commit e3334c9

Please sign in to comment.