Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # IMPORTANT THINGS:
- # Made for Python 2.7
- # REQUIRES BeatifulSoup4 (pip install beatifulsoup4)
- import requests
- import re
- import hashlib
- from bs4 import BeautifulSoup
- forumThread = "4243377-b-steam-spiele-s-bietet-mir" # Thread ID + name (ex: "4239749-cheap-steam-game-shop")
- print("Hello world!\n")
- fullURL = "http://www.elitepvpers.com/forum/elite-gold-trading/" + forumThread + ".html" # Formats the URL
- print("Read URL as: " + fullURL + "\n")
- Username = ""
- Password = ""
- loginURL = "http://www.elitepvpers.com/forum/login.php?do=login"
- pwmd5 = hashlib.md5(Password.encode("UTF-8")).hexdigest()
- print("Password hashed as: " + pwmd5 + "\n")
- payload = {
- "vb_login_username": Username,
- "s": "",
- "securitytoken": "guest",
- "do": "login",
- "vb_login_md5password": pwmd5,
- "vb_login_md5password_utf": pwmd5
- }
- headers = {
- "Referer": "http://www.elitepvpers.com/forum/"
- }
- with requests.Session() as s:
- pwmd5 = hashlib.md5(Password.encode("UTF-8")).hexdigest()
- p = s.post(loginURL, data=payload, headers=headers)
- r = s.get(fullURL)
- output = open("output.html", "w")
- output.write(r.text.encode("ISO-8859-1", "ignore"))
- output.close()
- soup = BeautifulSoup(r.text, "html.parser")
- posts = soup.findAll("div", {"itemprop": "text"})
- for nya in posts:
- regex = re.findall("href=\"(|\/\/|http(|s):\/\/)www\.elitepvpers\.com\/forum\/elite-gold-trading\/([0-9]+-(.+)){1}\.html\"", str(nya))
- for poi in regex:
- print("".join(poi)[1:] + "\n")
- output = open("output.html", "w")
- output.write(str(posts))
- output.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement