Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Viewers Bot for Specific URL
#1
I'm pretty new to coding and self-teaching. I've been trying to create a viewers bot that will take usernames + passwords from a text file and login to a website go to a specific chat room with a proxy and stay in that room until I stop the script. But seems I'm stuck at page login. Any explanation would be greatly appreciated.
from bs4 import BeautifulSoup
import requests
from lxml.html import fromstring

def get_proxies():
    url = 'https://www.sslproxies.org/'
    response = requests.get(url)
    parser = fromstring(response.text)
    proxies = set()
    for i in parser.xpath('//tbody/tr')[:10]:
        if i.xpath('.//td[7][contains(text(),"yes")]'):
            
            proxy = ":".join[i.xpath('.//td[1]/text()'[0], i.xpath('.//td[2]/text()')[0])]
            proxies.add(proxy)
    return proxies

# Login
def login():
    username = input("Please enter your username")
    password = input("Please enter your password")
    for line in open("user_accounts.txt", "r").readlines(): 
        login_info = line.split() 
        if username == login_info[0] and password == login_info[1]:
            print("Correct Credentials")
            return True
        print("Incorrect Credentials.")
        return False

# URL to Login To 
        
payload = {"username":"<username>", "password":"<password>", "login":"<login>"}


session_requests = requests.session()
login_url = "https://www.example.com"
result = session_requests.get(login_url)
html =  login_url

tree = html.fomstring(result.text)
result = session_requests.post(login_url, data = payload, headers = dict(referer=login_url))

url = 'https:www.exmaple.com'
result = session_requests.get(url, headers = dict(referer = url))

tree = html.fromstring(result.content)
bucket_names = tree.xpath("//div[@class='repo-list--repo']/a/text()")
print(bucket_names)

result.ok  
result.status_code
Reply


Messages In This Thread
Viewers Bot for Specific URL - by Peanut87 - Sep-23-2019, 04:29 PM
RE: Viewers Bot for Specific URL - by metulburr - Sep-23-2019, 06:37 PM
RE: Viewers Bot for Specific URL - by Peanut87 - Sep-24-2019, 03:56 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020