Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # encoding=utf8
- import requests
- from bs4 import BeautifulSoup
- import fnmatch
- import sys
- import codecs
- import time
- import re
- import random
- import string
- from string import ascii_lowercase as al
- from datetime import datetime
- import pickle
- import os.path
- #login vv vv
- login_data = dict(username='USERNAME', password='PASSWORD')
- headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
- def innerHTML(element):
- return element.decode_contents(formatter="html")
- s = requests.session()
- s.post('https://ultimategamer.club/account-login.php', data=login_data, headers=headers)
- link = "https://ultimategamer.club/torrents.php?cat=56"
- print "1"
- shit = True
- while shit:
- r = s.get(link)
- soup = BeautifulSoup(r.content,"html.parser")
- titles = soup.find_all("a")
- print "len"
- print len(titles)
- for title in titles:
- if fnmatch.fnmatch(title.get("href"),"*torrents-details.php?id=*"):
- with open('titlesUGC.txt', 'a') as f:
- f.write(title.get('title').encode('ascii', 'ignore')+"\n")
- print "3"
- nextlinks = titles
- foundNext = False
- for nextlink in nextlinks:
- try:
- if fnmatch.fnmatch(innerHTML(nextlink.b),"Next*"):
- foundNext = True
- link = "https://ultimategamer.club/" + str( nextlink.get('href') )
- break
- except:
- i = 1
- print "4"
- print link
- if foundNext == False:
- shit = False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement