Skip to content

Instantly share code, notes, and snippets.

/private-bay Secret

Created August 8, 2016 14:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save anonymous/b7a3300f42bac9f2b4987188f14ca5e1 to your computer and use it in GitHub Desktop.
Save anonymous/b7a3300f42bac9f2b4987188f14ca5e1 to your computer and use it in GitHub Desktop.
import pyquery
import requests
import json
from lxml import html
from pyquery import PyQuery as pq
import re
SEARCH_WORD = 'shkd'
f = open( SEARCH_WORD + ".txt", "w")
def get_links(search_word, page_number):
try:
r = requests.get('http://pirateproxy.one/search/' + str(search_word) + '/' + str(page_number) + '/7/', verify=False)
content = r.content
d = pq(content)
for i in d('a'):
link = str(d(i).attr("href"))
magnet_link = re.findall(r"magnet.*", link)
if (len(magnet_link) > 0):
print >> f, magnet_link[0]
finally:
return '1'
#============================================================
if __name__ == '__main__':
for page_number in range(0, 5):
get_links( SEARCH_WORD, page_number)
print "\n ==" + str(page_number)
print "\n\n===========done !!!! ==============="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment