emkor / napi-py Goto Github PK
View Code? Open in Web Editor NEWThis project forked from gabrys/napi.py
CLI tool for downloading subtitles from napiprojekt.pl
License: GNU General Public License v3.0
This project forked from gabrys/napi.py
CLI tool for downloading subtitles from napiprojekt.pl
License: GNU General Public License v3.0
So one thing I noticed is that you could get rid of the necessity of having 7z
as an external tool completely.
You can manage it using py7zlib
package. Here's a sample code how I'm using it:
from io import BytesIO
import base64
import xml.etree.ElementTree as ET
from py7zlib import Archive7z
response = requests.post(
url='http://www.napiprojekt.pl/api/api-napiprojekt3.php',
data=dict(
downloaded_subtitles_id=movie_hash,
downloaded_subtitles_lang='PL',
client='NapiProjekt',
mode=17,
)
)
parser = ET.XML(response.content)
content = parser.find('subtitles').find('content').text
decoded_content = base64.b64decode(content)
buffer = BytesIO(decoded_content)
archive = Archive7z(buffer, password='iBlm8NTigvru0Jr0')
encoded_subtitles = archive.getmember(0).read()
subtitles = encoded_subtitles.decode('Windows-1250 or some other encoding')
Don't ask me about the password
since I don't know where it came from, I found this piece of code somewhere on Github and did a little refactor, since it was outdated. But it does it's job obviously and doesn't require 7z
at all.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.