Skip to content

Added driver choice #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions Download Youtube Video from cmd using python/youtube.ide.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import urllib.request
import json
import time
import argparse
import selenium
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
Expand All @@ -18,15 +19,27 @@
print(name)
try:

# Phantom JS
ap = argparse.ArgumentParser()
ap.add_argument("-d", "--driver", type=str, default="phantomjs",
help="which driver to use [option: phantomjs, firefox, chrome]")

driver = webdriver.PhantomJS(executable_path=r'C:\Users\ankit\Downloads\phantomjs-2.1.1-windows (1)\phantomjs-2.1.1-windows\bin\phantomjs.exe')
driver.set_window_size(1120, 550)
args = vars(ap.parse_args())
choice = args["driver"]

# FireFox
driver = ""
if choice == "firefox":
binary = FirefoxBinary('firefox')
driver = webdriver.Firefox(firefox_binary=binary)
elif choice == "chrome":
driver = webdriver.Chrome();
elif choice == "phantomjs":
driver = webdriver.PhantomJS(
executable_path=r'phantomjs')
else:
print("Invalid Choice");
sys.exit(1);

# binary = FirefoxBinary('C:\Program Files (x86)\Mozilla Firefox\Firefox.exe')
# driver = webdriver.Firefox(firefox_binary=binary)
driver.set_window_size(1120, 550)

driver.get("http://en.savefrom.net")
shURL = driver.find_element_by_xpath('//input[@id="sf_url" and @type="text"]')
Expand All @@ -40,10 +53,6 @@
url_parse = click.get("href")
driver.quit()
path = os.getcwd()
# print("Downloading Starts..\n")
# print(url_parse)
# urllib.request.urlretrieve(url_parse, name)


installs = [
'idman.exe /n /d ' + '"' + url_parse + '"' + ' /p ' + '"' + path + '"' + ' /f ' + '"' + name + '"' + ' /q',
Expand Down
31 changes: 23 additions & 8 deletions Download Youtube Video from cmd using python/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import requests
import json
import selenium
import argparse
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.keys import Keys
Expand Down Expand Up @@ -115,22 +116,36 @@ def reporthook(blocknum, blocksize, total):
sizeType = ''
flag = 0




url = input("Enter the Youtube-url\n")
name = input("Enter the name for the video\n")
name = name+".mp4"
try:

# Phantom JS
ap = argparse.ArgumentParser()
ap.add_argument("-d", "--driver", type=str, default="phantomjs",
help="which driver to use [option: phantomjs, firefox, chrome]")

args = vars(ap.parse_args())
choice = args["driver"]

driver = ""
if choice == "firefox":
binary = FirefoxBinary('firefox')
driver = webdriver.Firefox(firefox_binary=binary)
elif choice == "chrome":
driver = webdriver.Chrome();
elif choice == "phantomjs":
driver = webdriver.PhantomJS(
executable_path=r'phantomjs')
else:
print("Invalid Choice");
sys.exit(1);

driver = webdriver.PhantomJS(
executable_path=r'C:\Users\ankit\Downloads\phantomjs-2.1.1-windows (1)\phantomjs-2.1.1-windows\bin\phantomjs.exe')
driver.set_window_size(1120, 550)

# FireFox

# binary = FirefoxBinary('C:\Program Files (x86)\Mozilla Firefox\Firefox.exe')
# driver = webdriver.Firefox(firefox_binary=binary)

driver.get("http://en.savefrom.net")
shURL = driver.find_element_by_xpath(
'//input[@id="sf_url" and @type="text"]')
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy