mirror of
https://github.com/vikstrous/pirate-get
synced 2025-01-10 10:04:21 +01:00
Revert "Merge pull request #7 from gausie/check_error_code_for_mirrors"
This reverts commit1c8f5056a5
, reversing changes made to951fc1a28d
.
This commit is contained in:
parent
1c8f5056a5
commit
5432de0b0e
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import webbrowser
|
import webbrowser
|
||||||
import urllib
|
import urllib
|
||||||
import requests
|
import urllib2
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
from HTMLParser import HTMLParser
|
from HTMLParser import HTMLParser
|
||||||
@ -67,7 +67,8 @@ def main():
|
|||||||
# Catch the Ctrl-C exception and exit cleanly
|
# Catch the Ctrl-C exception and exit cleanly
|
||||||
try:
|
try:
|
||||||
for page in xrange(pages):
|
for page in xrange(pages):
|
||||||
res = requests.get(mirror + '/search/' + args.q.replace(" ", "+") + '/' + str(page) + '/7/0').text
|
f = urllib2.urlopen(mirror + '/search/' + args.q.replace(" ", "+") + '/' + str(page) + '/7/0')
|
||||||
|
res = f.read()
|
||||||
found = re.findall(""""(magnet\:\?xt=[^"]*)|<td align="right">([^<]+)</td>""", res)
|
found = re.findall(""""(magnet\:\?xt=[^"]*)|<td align="right">([^<]+)</td>""", res)
|
||||||
|
|
||||||
# get sizes as well and substitute the character
|
# get sizes as well and substitute the character
|
||||||
@ -101,18 +102,16 @@ def main():
|
|||||||
if args.database:
|
if args.database:
|
||||||
mags = local(args)
|
mags = local(args)
|
||||||
else:
|
else:
|
||||||
mirrors = ["http://thepiratebay.se/"]
|
mirrors = ["http://thepiratebay.se"]
|
||||||
try:
|
try:
|
||||||
res = requests.get("http://proxybay.info/list.txt").text
|
f = urllib2.urlopen("http://proxybay.info/list.txt")
|
||||||
|
res = f.read()
|
||||||
mirrors += res.split("\n")[3:]
|
mirrors += res.split("\n")[3:]
|
||||||
except:
|
except:
|
||||||
print "Could not fetch additional mirrors"
|
print "Could not fetch additional mirrors"
|
||||||
for mirror in mirrors:
|
for mirror in mirrors:
|
||||||
try:
|
try:
|
||||||
print("Trying " + mirror)
|
print("Trying " + mirror)
|
||||||
code = requests.head(mirror).status_code
|
|
||||||
if code != 200:
|
|
||||||
continue
|
|
||||||
mags, sizes, uploaded = remote(args, mirror)
|
mags, sizes, uploaded = remote(args, mirror)
|
||||||
break
|
break
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
Loading…
Reference in New Issue
Block a user