这是我用python编写的用于打开youtube下载页面的代码
#! python3
#web browser
import webbrowser,sys,pyperclip
from selenium import webdriver
browser=webdriver.Firefox()
sys.argv
if len(sys.argv)>1:
address=' '.join(sys.argv[1:])
else:
address=pyperclip.paste()
#https://www.youtube.com/watch?v=PHULePbksEU&lc=z23zexnimznmtjzhm04t1aokgivrnxqnqfdkgrw0qagprk0h00410
address=address[12:]
#webbrowser.open("https://www.flipkart.com/search?q="+address)
browser.get("ss"+address)
我收到如下错误:-
Traceback (most recent call last):
File "C:/Users/Ali Akber/AppData/Local/Programs/Python/Python36/youtubeDownloader.py", line 14, in <module>
browser.get("ss"+address)
File "C:\Users\Ali Akber\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 326, in get
self.execute(Command.GET, {'url': url})
File "C:\Users\Ali Akber\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 314, in execute
self.error_handler.check_response(response)
File "C:\Users\Ali Akber\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: Malformed URL: ss
import webbrowser,sys,pyperclip
from selenium import webdriver
browser=webdriver.Firefox()
sys.argv
if len(sys.argv)>1:
address=' '.join(sys.argv[1:])
else:
address=pyperclip.paste()
address = address [12:]
browser.get(“ ss” +地址)
不是有效的网址。