Skip to content

Instantly share code, notes, and snippets.

@AnthonyBloomer
Created January 3, 2019 00:36
Show Gist options
  • Save AnthonyBloomer/802028474259e23bd29809779bcbd803 to your computer and use it in GitHub Desktop.
Save AnthonyBloomer/802028474259e23bd29809779bcbd803 to your computer and use it in GitHub Desktop.
Get working rarbg mirror
import requests
import sys
if __name__ == "__main__":
mirrors = [
'https://www.rarbg.is/',
'https://rarbgunblock.com/',
'https://rarbgmirror.com/',
'http://rarbgaccess.org/',
'http://rarbgmirror.org/',
'http://rarbgmirror.xyz/',
'http://rarbgproxy.org/',
'https://rarbg.unblocked.vc/',
'https://filesdownloader.com',
'https://sitenable.ch'
]
times = []
index = 0
available_mirrors = []
for mirror in mirrors:
try:
res = requests.get(mirror)
time = res.elapsed.total_seconds()
if res.ok:
if not times:
times.append([index, time])
else:
if times[0][1] > time:
times.pop()
times.append([index, time])
available_mirrors.append(mirror)
except Exception as e:
continue
index += 1
if not times:
print("Could not find working mirror.")
sys.exit(1)
print("Fastest mirror is: %s" % mirrors[times[0][0]])
print("All available mirrors: ")
for available_mirror in available_mirrors:
print(available_mirror)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment