Flexget

Sección para comentarios o preguntas / Use this section for any comments or questions...
User avatar
Mochomo
Site Admin
Site Admin
Posts: 707
Joined: Wed May 25, 2022 2:34 pm
Location: Paddock

Re: Flexget

Post by Mochomo »

Hi SennaF1, I created this python script to perform a simple login into the forum using Selenium Webdriver with Chrome.

These are the variables I edited -->

chrome_driver_path = 'path/to/chromedriver'
username = "Admin"
password = "XXXXXXXXXX"

Code: Select all

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options

# Path to the ChromeDriver executable
chrome_driver_path = 'path/to/chromedriver'

# Set Chrome options
chrome_options = Options()
chrome_options.add_argument("--headless")  # Run Chrome in headless mode

# Start the WebDriver
driver = webdriver.Chrome(service=Service(chrome_driver_path), options=chrome_options)

# Replace with your PHPBB forum URL
forum_url = "https://f1carreras.net"

# Replace with your forum username and password
username = "Admin"
password = "XXXXXXXXXX"

# Navigate to the login page
driver.get(f"{forum_url}/ucp.php?mode=login")

# Find the username and password input fields, and enter the credentials
username_field = driver.find_element(By.NAME, "username")
username_field.send_keys(username)

password_field = driver.find_element(By.NAME, "password")
password_field.send_keys(password)

# Submit the login form
login_button = driver.find_element(By.NAME, "login[]")
login_button.send_keys(Keys.RETURN)

# Wait for the login process to complete (you may need to adjust the delay if needed)
driver.implicitly_wait(5)

# Check if login was successful
if "You have been successfully logged in" in driver.page_source:
    print("Login successful!")
else:
    print("Login failed!")

# Close the browser
driver.quit()

Once I run the python script I get this output -->

Image

Any idea of the error message? Would you able to provide your python code for login into the forum? (remove sensitive data) ... Thanks.
 ! Message from: Mochomo
NOS MUDAMOS A TRACKER TORRENT -- LEER Y REGISTRO -> AQUI

WE ARE MOVING TO A TORRENT TRACKER -- READ AND SIGN UP -> HERE
User avatar
Mochomo
Site Admin
Site Admin
Posts: 707
Joined: Wed May 25, 2022 2:34 pm
Location: Paddock

Re: Flexget

Post by Mochomo »

I was able to pass over above error message. Now I have a response error -->
<div class="error">The submitted form was invalid. Try submitting again.</div> <dl>
It would be really helpful if you can provide your code.
 ! Message from: Mochomo
NOS MUDAMOS A TRACKER TORRENT -- LEER Y REGISTRO -> AQUI

WE ARE MOVING TO A TORRENT TRACKER -- READ AND SIGN UP -> HERE
User avatar
SennaF1
Posts: 16
Joined: Sat Sep 24, 2022 10:38 pm

Re: Flexget

Post by SennaF1 »

Hey… just now seeing this 2nd page. I replied but the site lost it and wanted me to log in again. :). Just happens a second time too. Anyway, I’ll send you some code.

Also, I’m guessing you will have or need a file containing the pieces of info needed to make a post…?

Area: practice
Title: topic title
Torrent url:
Magnet url:
Other stuff:

Then code should process this file, log in, make post, etc. I’ll send code tonight!
User avatar
SennaF1
Posts: 16
Joined: Sat Sep 24, 2022 10:38 pm

Re: Flexget

Post by SennaF1 »

Hey, I DM'd you code on Saturday. Let me know what else I can do to help.
User avatar
Mochomo
Site Admin
Site Admin
Posts: 707
Joined: Wed May 25, 2022 2:34 pm
Location: Paddock

Re: Flexget

Post by Mochomo »

Hi SennaF1, yes I received it, thanks.
I haven't had some free time to work on the code updates. Most likely this Friday I will be able to work on it. Keep you posted.
 ! Message from: Mochomo
NOS MUDAMOS A TRACKER TORRENT -- LEER Y REGISTRO -> AQUI

WE ARE MOVING TO A TORRENT TRACKER -- READ AND SIGN UP -> HERE
User avatar
Mochomo
Site Admin
Site Admin
Posts: 707
Joined: Wed May 25, 2022 2:34 pm
Location: Paddock

Re: Flexget

Post by Mochomo »

Hey SennaF1, sorry for the delay, I was tied with work and family. Using your example I finally made the proper updates to the code, now I'm able to login 8-) -- Now I have to work on the code for creating a new topic. I will let you know how it goes on the upcoming days. Thanks again for your help.
 ! Message from: Mochomo
NOS MUDAMOS A TRACKER TORRENT -- LEER Y REGISTRO -> AQUI

WE ARE MOVING TO A TORRENT TRACKER -- READ AND SIGN UP -> HERE
User avatar
SennaF1
Posts: 16
Joined: Sat Sep 24, 2022 10:38 pm

Re: Flexget

Post by SennaF1 »

Great! BTW, I use the Chrome Developer tools to get the paths needed for locating elements in the python code.
User avatar
Mochomo
Site Admin
Site Admin
Posts: 707
Joined: Wed May 25, 2022 2:34 pm
Location: Paddock

Re: Flexget

Post by Mochomo »

BBCODE is not working in message. I have set this code in python -->

Code: Select all

# Set message
message = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.ID, "message")))
message.click()
bbcode = '[b][size=150]HI WORLD[/size][/b]'
message.send_keys(bbcode)
I expect this output -->

Image

This is how Selenium is processing it -->

Image

See how Selenium sends BBCODE to message -->

Code: Select all

b]size][[b][size=150]HI WORLD[
For some reason is not sending the message as per my python code. I'm not sure why is not working.
Should I try to do a "copy" and "paste" instead?
 ! Message from: Mochomo
NOS MUDAMOS A TRACKER TORRENT -- LEER Y REGISTRO -> AQUI

WE ARE MOVING TO A TORRENT TRACKER -- READ AND SIGN UP -> HERE
User avatar
SennaF1
Posts: 16
Joined: Sat Sep 24, 2022 10:38 pm

Re: Flexget

Post by SennaF1 »

Hey.. Did a web search and maybe you should Try 3 tick marks at each end
bbcode = '''HI WORLD'''
OK, So the site actually interpreted my code, hopefully you understand. Just use 3 tick marks instead of 1

Also test using double quotes instead of 3 ticks: "TEST"
User avatar
Mochomo
Site Admin
Site Admin
Posts: 707
Joined: Wed May 25, 2022 2:34 pm
Location: Paddock

Re: Flexget

Post by Mochomo »

Not working for me. I tried 3 ticks, double quotes, single tick and double quotes. Same wrong output.

If I use just regular text then message body is OK, it seems selenium doesn't like bbcode.
 ! Message from: Mochomo
NOS MUDAMOS A TRACKER TORRENT -- LEER Y REGISTRO -> AQUI

WE ARE MOVING TO A TORRENT TRACKER -- READ AND SIGN UP -> HERE
Post Reply