Jump to content
yo20063

Cine iti citeste thread-ul?

Recommended Posts

Posted (edited)

Avand in vedere ca a fost scoasa functia de a vedea cine iti urmareste thread-ul, am facut un mic script pentru a vedea totusi :)

Trebuie sa instalati libraria lxml si requests ca sa functioneze

from lxml import html
import requests
import warnings
import time

warnings.filterwarnings("ignore")

data = {
"do":"login",
"vb_login_username":" ", # username-ul tau
"vb_login_password":" ", # parola ta
"cookieuser": "1"
}

headers = {
"User-agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1",
"Referer":"https://rstforums.com/forum/online.php"
}


auth = "https://rstforums.com/forum/login.php"
req = requests.post(auth, headers=headers, data=data)
cookies = dict(req.cookies)
tree = html.fromstring(req.text)
sesiune = tree.xpath('///div[@id="redirect_button"]/a/@href')
sesiune = [elem.replace("https://rstforums.com/forum/online.php", "") for elem in sesiune]
sesiune = sesiune[0]
url = "https://rstforums.com/forum/online.php?order=asc&sort=username&pp=100&page=1" + sesiune
online = requests.get(url, cookies=cookies)
body = html.fromstring(online.text)

users = body.xpath('//tr/td[@class="whoinfo"]/a/text()')
numar =[]
for i in (xrange(2,len(users)+2)):
numar.append(i)

users_threads = []
for i in numar:
i = str(i)
users = body.xpath('//tr['+i+']/td[@class="whoinfo"]/a/text()|//tr['+i+']/td[3]/div/a/text()')
users_threads.append(users)


for sublist in users_threads:
if len(sublist) != 2:
sublist.insert(2,"Nu urmareste un thread anume!")

thread = raw_input("Introdu' numele thread-ului: ")

for i in xrange(0, len(users_threads)):
if thread in users_threads[i][1]:
print users_threads[i][0] + " urmareste thread-ul introdus de tine!"

Deocamdata e facut doar pentru membri, fara guests, dar se poate completa rapid.

Untitled.png

Edited by yo20063
  • Upvote 2
Posted
Si cum functioneaza? Si ce limbaj e? Cum se ruleaza?

Da detalii cand imparti ceva ca nu toti stim Python si compilere catre .exe.

Salvezi codul intr-un fisier numit script.py, instalezi Python si apoi din consola Python rulezi ./script.py sau script.py sau scrii python script.py.

Nu-i asa ?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...