mirror of
https://github.com/vikstrous/pirate-get
synced 2025-01-10 10:04:21 +01:00
initial commit
This commit is contained in:
commit
30b9e30fd6
18
README.md
Normal file
18
README.md
Normal file
@ -0,0 +1,18 @@
|
||||
pirate-get
|
||||
---
|
||||
|
||||
pirate-get is a convenient command line tool to speed up your trip to the pirate bay and get your completely legal torrents more quickly.
|
||||
|
||||
Tested only on Ubuntu.
|
||||
|
||||
Installation
|
||||
---
|
||||
|
||||
Make sure you have python (2.7.3?) installed.
|
||||
|
||||
Run install.sh
|
||||
|
||||
Usage
|
||||
---
|
||||
|
||||
pirate-get <search query>
|
1
install.sh
Executable file
1
install.sh
Executable file
@ -0,0 +1 @@
|
||||
cp pirate-get.py /usr/bin/pirate-get
|
23
pirate-get.py
Executable file
23
pirate-get.py
Executable file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env python
|
||||
import webbrowser
|
||||
import urllib
|
||||
import urllib2
|
||||
import sys
|
||||
import re
|
||||
|
||||
if(len(sys.argv) == 1):
|
||||
print "usage: pirate-get <search query>"
|
||||
exit()
|
||||
q = sys.argv[1]
|
||||
f = urllib2.urlopen('http://thepiratebay.se/search/'+q.replace(" ", "+")+'/0/7/0')
|
||||
|
||||
mag = re.findall(""""(magnet\:\?xt=[^"]*)""", f.read())
|
||||
|
||||
if mag:
|
||||
for m in range(len(mag)):
|
||||
name = re.search("dn=([^\&]*)", mag[m])
|
||||
print str(m)+".", urllib.unquote(name.group(1).encode('ascii')).decode('utf-8').replace("+", " ")
|
||||
l = raw_input("Select a link: ")
|
||||
webbrowser.open(mag[int(l)])
|
||||
else:
|
||||
print "no results"
|
Loading…
Reference in New Issue
Block a user