r/Python • u/santiagobasulto • Dec 29 '12
Simple script to download TPB torrent files
https://github.com/santiagobasulto/tpb-download/blob/master/README.md1
1
Jan 01 '13
can someone please explain the usage of name and main???
i see these all over the place but for the life of me i have no clue what it means or where to find it in the python docs.
2 weeks into python.
thanks!
1
u/DiThi Jan 02 '13
When you do
import somethingthe contents of the file something.py is executed. Say you want to use that file as a stand-alone executable but also as a module, and you don't want the stand-alone code to be executed when imported as a module.
Well... there's a special variable called __name__ which holds the module name... if imported as a module, otherwise it's "__main__".
Type "__this__" in reddit comments to write "__this__" instead of "this".
1
Jan 02 '13
ahhh I see! thank you very much. I just found the documentation on importing modules now that I know where to look, so I'll figure out to implement this.
yeah, I noticed my error in posting but figured it wouldn't be worthing editing because the thread was getting old and had little attention.
-1
u/AndrewCoja Dec 29 '12
There is a link to download the torrent file on TPB.
3
u/Han-ChewieSexyFanfic Dec 29 '12
Not for newer torrents, only the magnet link is visible.
3
u/qnrq Dec 29 '12 edited Dec 29 '12
Magnet links can keep BitTorrent hosts out of jail; the TPB founders were convicted for hosting torrent files. Why not just use a client that supports them?
EDIT: By the way your link goes to README.md. README.md is displayed directly on the project page here, and if you link there people don't have to click twice to find the script src: https://github.com/santiagobasulto/tpb-download
EDIT2: Also, wouldn't it be better to parse the magnet link or the link to the torrent page on TPB instead? IDs suck.
1
u/mgrandi Dec 29 '12
yep. the magnet link makes it so that they arnt hosting the torrent files, that way you download the torrent files from other people.
1
u/Han-ChewieSexyFanfic Dec 29 '12 edited Dec 29 '12
It's not my link and it's not my project. I was just answering AndrewCoja's comment.
0
0
Dec 29 '12
[deleted]
2
Dec 29 '12
It does. For instance http://torrents.thepiratebay.se/7968597/7968597.torrent links to the torrent here.
4
u/tty2 Dec 29 '12