Created
August 11, 2020 09:13
-
-
Save ShaneLee/62bb4e0aa8ab4fc5d29982cfa4a56561 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess, urllib, random | |
class NoBlocks(Exception): pass | |
def getblocks(): | |
r = urllib.urlopen("http://{?REDACTED?}/grab").read() | |
if '<html' in r.lower(): raise NoBlocks | |
return r.split() | |
import sys | |
if len(sys.argv) > 1: | |
prefix = ['--socks5', sys.argv[1]] | |
else: | |
prefix = []#'-interface','eth0:1'] | |
line = lambda x: ['curl'] + prefix + ['-H', "Cookie: TENACIOUS=" + str(random.random())[3:], '-o', 'pdfs/' + str(x) + '.pdf', "http://www.jstor.org/stable/pdfplus/" + str(x) + ".pdf?acceptTC=true"] | |
while 1: | |
blocks = getblocks() | |
for block in blocks: | |
print block | |
subprocess.Popen(line(block)).wait() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment