Logan1x / Python-Scripts

Collection of Various Python Script's.💻
https://logan1x.github.io/Python-Scripts/
MIT License
305 stars 148 forks source link

I cannot use youtube-bot "SyntaxError: invalid syntax" #98

Closed Rurounius closed 4 years ago

Rurounius commented 4 years ago

This is my fault, i know but i don't know what to do. I just wrote the url and i took the "SyntaxError: invalid syntax" error message. Thanks for the scripts, but unfortunately i couldn't use.

import time
import webbrowser
import os

url = str(input("Enter your video url in ->\"https://www.youtube.com/watch?v=blabla\"<-  : "))
n = input("Enter refresh rate(seconds) : 70")
brow = input("Enter your default browser in ->\"Firefox ESR"<-  : ")
while (1):
    os.system(" killall -9 " + brow)
    time.sleep(int(n))
    webbrowser.open(url)
    print('Successfully Viewd')

Can u help me? What is my fault?

Logan1x commented 4 years ago

Can you show the terminal output for full error?

Rurounius commented 4 years ago

Can you show the terminal output for full error?

ofc dear. it's here. sorry about that, i'm very noob. :))

dot

Logan1x commented 4 years ago

Just remove that part, its just way of asking which browser you are using. Replace it by,

brow = input("Enter your default browser ")

You found issue in the program,

python needs escape character to enter illegal character in string, more about it here, here " is an illegal character, in order to use that in our string we need to add escape character i.e. \ . replace it like this and your issue will be solved.

brow = input("Enter your default browser in ->\"Firefox ESR\"<- : ")

i'm very noob

Not a problem, everyone is noob at beginning.

If you want, you can send a pull request with changes :)

Logan1x commented 4 years ago

I tried to run the script and you might find problem in following lines,

n = input("Enter refresh rate(seconds) : 70")

This line is for how often you want to open new YouTube page. So when in terminal it asks for input give it a number(better if in range of 40 - 70) and then press enter.

brow = input("Enter your default browser in ->\"Firefox ESR\"<- : ")

When your program run this line it will ask you for default browser, when you enter your browser name it may say Firefox: no process found or Name_you_entered: no process found. Don't worry program will still run, just wait for the time you entered in refresh rate and new tab in browser will open with YouTube link.

Logan1x commented 4 years ago

does not increase view rate.

It was bound to happen. YouTube has does some background checking. So if the request come from same IP, it count it as double and doesn't count it to view.

So I want you to run the script and then break it to you because you learn, error handling, how to make issues and even how to ask community.

I am not sure that you will be able to increase your views on YouTube or not but I'll definitely teach you a lot(it was my motivation for programming). So stick to it and try more things. Like one thing you can do here is to check with changing IP every time you run this script.

Good luck for your future :)