Skip to content

Instantly share code, notes, and snippets.

@lst15
Created April 10, 2018 14:19
Show Gist options
  • Select an option

  • Save lst15/7cf9922c1280c8ae4f57b4b70b20b1a1 to your computer and use it in GitHub Desktop.

Select an option

Save lst15/7cf9922c1280c8ae4f57b4b70b20b1a1 to your computer and use it in GitHub Desktop.
gistminer.miner.gist.python
#LINHA 31: COLOCAR DIRETORIO ONDE SERA SALVO TODOS OS GISTCODE
#LINHA 32: COLOCAR LINK NO QUAL SERA 'GISTADO'
import requests
from bs4 import BeautifulSoup
from threading import Thread
class varGlobal():
nav = 0
def main(diretorioASalvar,linkGistProfile):
varGlobal.nav += 1
gitProfile = requests.get(linkGistProfile + '?page=' + str(varGlobal.nav))
soup = BeautifulSoup(gitProfile.content, 'html.parser')
while bool(soup.find('a', class_='link-overlay')) == True:
for i in soup.find_all('a', class_='link-overlay'):
soupIntern = BeautifulSoup(requests.get(i.get('href')).content,'html.parser')
saveNote = open(diretorioASalvar + soupIntern.find('strong', class_='css-truncate-target').string.replace('.py', '').replace('.txt', '') + '.txt', 'w')
print soupIntern.find('strong', class_='css-truncate-target').string
internalLinkedRaw = soupIntern.find('a',class_='btn btn-sm').get('href').replace('archive', 'raw').replace('.zip', '')
internalLinkedRaw = requests.get('https://gist.githubusercontent.com' + internalLinkedRaw)
saveNote.write(internalLinkedRaw.content)
saveNote.close
varGlobal.nav += 1
gitProfile = requests.get(linkGistProfile + str(varGlobal.nav))
soup = BeautifulSoup(gitProfile.content, 'html.parser')
print ('Certifique-se que o diretorio de arquivamento especificado esteja de acordo com sua escolha.')
dir = 'C:/Users/Leandro/Desktop/teste/'
linked = 'https://gist.github.com/fmasanori'
if raw_input('[y/n] Iniciar / Sair\n') == 'y':
for i in range(5):
t = Thread(target=main, args=(dir, linked),)
t.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment