commit
a4b69b0c39
13
README.md
13
README.md
@ -44,14 +44,19 @@ also @alphatr write a tool transform .aria2 file to a magnet link use javascript
|
|||||||
# ================================================================
|
# ================================================================
|
||||||
```
|
```
|
||||||
|
|
||||||
# how to run
|
## how to run
|
||||||
|
|
||||||
```
|
|
||||||
python aria2_to_magnet.py -f dahufa.aria2
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python aria2_to_magnet.py dahufa.aria2
|
||||||
```
|
```
|
||||||
|
|
||||||
output
|
output
|
||||||
```
|
```
|
||||||
magnet:?xt=urn:btih:959E2ECEB954313D3869EFF7924CA7CD8DE739
|
magnet:?xt=urn:btih:959E2ECEB954313D3869EFF7924CA7CD8DE739
|
||||||
```
|
```
|
||||||
|
|
||||||
|
with multiple files
|
||||||
|
```bash
|
||||||
|
python aria2_to_magnet.py *.aria2
|
||||||
|
```
|
||||||
|
|
||||||
|
6
aria2_to_magnet.py
Normal file → Executable file
6
aria2_to_magnet.py
Normal file → Executable file
@ -1,9 +1,10 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
import struct
|
import struct
|
||||||
import binascii
|
import binascii
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("-f", "--file", required=True,
|
parser.add_argument("file", nargs='+',
|
||||||
help="input file XXX.aria2")
|
help="input file XXX.aria2")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
@ -75,7 +76,8 @@ def parse_aria_control_file(file_name):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
file_name = args.file
|
file_list = args.file
|
||||||
|
for file_name in file_list:
|
||||||
parse_aria_control_file(file_name)
|
parse_aria_control_file(file_name)
|
||||||
# version is 1
|
# version is 1
|
||||||
# hash length is 20
|
# hash length is 20
|
||||||
|
Loading…
Reference in New Issue
Block a user