Comments (8)
Could you try way 2 in this comment and check if it works?
with argument: hash_fields={"pieces root": (32, False)}
from torrent_parser.
I try data = tp.parse_torrent_file(str, hash_fields={"pieces root": (32, False)})
, Getting “torrent_parser.InvalidTorrentDataException: Fail to decode string at pos 1359 using encoding utf-8”
from torrent_parser.
It seems this v2 file has a piece layers
dict whose key and value are all hash bytes.
Current hash_fields
argument can't specify entrie dict.
For now, if you don't care about piece layers
values, you can add errors="replace"
to make parse success:
data = tp.parse_torrent_file(
"bittorrent-v2-test.torrent",
hash_fields={
"pieces root": (32, False),
},
errors="replace",
)
But if you edit data
and write back to file, the content of piece layers
will be incorrect.
I will publish a new version to solve this issue.
from torrent_parser.
Looking forward to new version,If I only edit the content except the piece layers, will I get an error when writing to the file?
from torrent_parser.
No error will be raise if you write back to file, it is the file content is incorrect.
Because error="replace"
argument of parse step replaced invalid utf8 bytes in piece layers
with Unicode Replacement Character
. In encode/write step, we can't restore origin bytes.
from torrent_parser.
v0.4.0 just published.
Please try it with tp.parse_torrent_file("bittorrent-v2-test.torrent")
without any other argument. In theory you should be able to successfully parse the file.
Feel free to continue this thread if you meet any issue when using the new version.
from torrent_parser.
It's working fine, thank you
from torrent_parser.
That's fine, then I'll close the issue.
If there are any subsequent issue, you can open a new one.
from torrent_parser.
Related Issues (12)
- UnicodeDecodeError: 'utf8' codec can't decode byte 0xb5 in position 1: invalid start byte HOT 4
- Changing trackers in announce-list corrupts save HOT 7
- Missing dependency typing_extensions HOT 3
- torrent_parser does not return "Info Hash v1" value HOT 6
- add functions to calculate v1 and v2 info hashes of torrent files HOT 3
- Python2.7 处理不存在的文件时出现 NameError: global name 'FileNotFoundError' is not defined HOT 1
- hello,I find something wrong in you code.. HOT 4
- UnicodeDecodeError HOT 7
- Same error with every torrent. HOT 2
- Web siders are sorted by length, but not by name. HOT 5
- UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 43 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torrent_parser.