Use pycurl to fetch the title database

This commit is contained in:
Xpl0itU 2024-04-03 13:30:17 +02:00
parent 8d21c58fe7
commit 9dcadb12bd
4 changed files with 19 additions and 14 deletions

View file

@ -17,7 +17,11 @@ jobs:
submodules: 'recursive' submodules: 'recursive'
- name: Install Dependencies - name: Install Dependencies
run: | run: |
brew install create-dmg dylibbundler gtk+3 brew uninstall curl
brew uninstall openssl
brew uninstall curl-openssl
brew install create-dmg dylibbundler gtk+3 openssl curl
python3 -m pip install --compile --ignore-installed pycurl
- name: Build - name: Build
run: | run: |
python3 grabTitles.py python3 grabTitles.py

View file

@ -25,7 +25,7 @@ jobs:
msystem: UCRT64 msystem: UCRT64
release: true release: true
update: 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-python-pycurl 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
- name: Build - name: Build
run: | run: |
python3 grabTitles.py python3 grabTitles.py

View file

@ -13,7 +13,7 @@ RUN mkdir -p /usr/share/man/man1 /usr/share/man/man2 && \
RUN apt-fast -y --no-install-recommends update && \ RUN apt-fast -y --no-install-recommends update && \
apt-fast -y --no-install-recommends upgrade && \ 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-pycurl && \
wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz && \ wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go*.linux-amd64.tar.gz && \ tar -C /usr/local -xzf go*.linux-amd64.tar.gz && \
chmod +x /usr/local/go/bin/go* && \ chmod +x /usr/local/go/bin/go* && \

View file

@ -1,8 +1,7 @@
#!/bin/env python #!/bin/env python
import os import os
import urllib.request import pycurl
import ssl
# Don't edit below this line # Don't edit below this line
@ -11,14 +10,16 @@ def checkAndDeleteFile(file):
print(f"Deleting {file}") print(f"Deleting {file}")
os.remove(file) os.remove(file)
# Disable certificate verification def cDownload(url, file):
ssl_context = ssl.create_default_context() with open(file, 'wb') as f:
ssl_context.check_hostname = False c = pycurl.Curl()
ssl_context.verify_mode = ssl.CERT_NONE c.setopt(c.URL, url)
c.setopt(c.WRITEDATA, f)
opener = urllib.request.build_opener(urllib.request.HTTPSHandler(context=ssl_context)) c.setopt(c.FOLLOWLOCATION, True)
opener.addheaders = [("User-agent", "NUSspliBuilder/2.1")] c.setopt(c.USERAGENT, "NUSspliBuilder/2.2")
urllib.request.install_opener(opener) c.setopt(c.ACCEPT_ENCODING, "")
c.perform()
c.close()
checkAndDeleteFile("db.go") checkAndDeleteFile("db.go")
urllib.request.urlretrieve("https://napi.v10lator.de/db?t=go", "db.go") cDownload("https://napi.v10lator.de/db?t=go", "db.go")