[PYTHON] Help me fix this script.

Stkr Dngr

Regular Member
Joined
Sep 14, 2017
Messages
301
Reaction score
43
Code:
print ("Striker Visitor")
print ("------------------------------------------------")
 
url1 = raw_input("example(dot)com:");
bar=int(input("20000"))
p11="proxy-site here";
p22="proxy-site here";
p33="proxy-site here";
p44="proxy-site here";
p55="proxy-site here";
def view():
    url2=url1
    vt=bar
    p1=p11
    p2=p22
    p3=p33
    p4=p44
    p5=p55
    if(vt%2!=0 and vt%3==0):
        url=p1+url2;
    elif(vt%2 ==0 and vt%4==0):
        url=p2+url2;
    elif(vt%2 ==0 or vt%4 ==0):
        url=p4+url2;
    elif(vt%2 !=0 or vt%3 ==0):
        url=p5+url2;
    else:
        url=p3+url2;
    opener = urllib2.build_opener()
    opener.addheaders = [('User-agent',
'Mozilla/5.0')]
    usock = opener.open(url)
    url = usock.geturl()
    data = usock.read()
    usock.close()
    print("Site Visited")
a=0
while(a!=bar):
    a=a+1
    view()

i keep getting error undefined name 'raw_input' how can i fix it

Error on console
Code:
Striker visitor
------------------------------------------------
Traceback (most recent call last):
  File "/home/dngr/file.py", line 5, in <module>
    url1 = raw_input("site(dot)com:");
NameError: name 'raw_input' is not defined
>>>
 
If you're using Python 3, just change raw_input() to input(). In Python 3, raw_input() was removed and input() works like raw_input() worked in Python 2.
 
That must be python 2 and python 3 compatibility issue. As advised by @chd17, try replacing raw_input() with input()

Code:
print ("Striker Visitor")
print ("------------------------------------------------")
 
url1 = input("example(dot)com:");
bar=int(input("20000"))
p11="proxy-site here";
p22="proxy-site here";
p33="proxy-site here";
p44="proxy-site here";
p55="proxy-site here";
def view():
    url2=url1
    vt=bar
    p1=p11
    p2=p22
    p3=p33
    p4=p44
    p5=p55
    if(vt%2!=0 and vt%3==0):
        url=p1+url2;
    elif(vt%2 ==0 and vt%4==0):
        url=p2+url2;
    elif(vt%2 ==0 or vt%4 ==0):
        url=p4+url2;
    elif(vt%2 !=0 or vt%3 ==0):
        url=p5+url2;
    else:
        url=p3+url2;
    opener = urllib2.build_opener()
    opener.addheaders = [('User-agent',
'Mozilla/5.0')]
    usock = opener.open(url)
    url = usock.geturl()
    data = usock.read()
    usock.close()
    print("Site Visited")
a=0
while(a!=bar):
    a=a+1
    view()
 
what that code some sort proxie protecting process and refereer .

i am from php sorry looks badly written ask me

make my spellings look normal lol
 
Wow. like magic, it worked. But there seemed to be another error in the pipeline.
Put this code
Code:
import urllib2
in line 1 and try to run, because it refers to line 29in the script.
It shows this error though in line 34
error(yellow triangle with exclamation mark in the center)
Code:
local variable 'data' is assigned but never used.

But the console doesn't return any errors, it just prints what's on line 4, if somebody can help fix the entire code i would appreciate it. But at this point i have had enough of bugs. I give up. help me if u can
 
By the way, this code is very ugly...

p11="proxy-site here";
p22="proxy-site here";
p33="proxy-site here";
p44="proxy-site here";
p55="proxy-site here";

The developer should not know the concept of lists in python...
 
Bro u really need to learn how to python properly xD
Just go to site like udemy to learn some basics
 
Code:
import itertools
import requests


def visit_site(web_site, proxy_sites, times):
    current_visits = 0
    from proxy_site in itertools.cycle(proxy_sites):
        visit = requests.get(web_site, headers={'User-Agen't : 'Mozilla/5.0'})
         current_visits += 1
         if current_visits == times:
             break
         print ('site visited')

proxies = ['proxy-site-1', 'proxy-site-2']
web_site = raw_input('Website to visit')
times = int(raw_input('20000'))
visit_site(web_site, proxy_sites, times)

There you go, please also learn some basic programming skills, as in the most basic skills.

I can't post links but this is what you posted before offering your "programming services"

Be plain here else nobody can help u. I didnt understand where u r going. But u can still hire me I charge literally a minute amount of

You have no concept of lists, functions, variables(why would you make a variable data if you aren't going to use it), linting.

My advice to you is to take a super basic programming course , then spend the next 2-3 months reading code on github. You will increase your skills by 100 fold. In other words, you are far from being ready on offering your programming services, because you really don't understand the most basic programming concepts.


Note: Requests is a library you have to install via pip,and is used always in place of urllib. The only reason you should use urllib is if you plan on making your script use nothing but standard libraries, otherwise use requests for everything requests related.
 
Back
Top