Remove previous code from media_files_extractor.py

This commit is contained in:
Benjamin Loison 2023-02-04 14:23:18 +01:00
parent 176b057edb
commit a327e8fdb2
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8

View File

@ -1,7 +1,6 @@
from selenium import webdriver from selenium import webdriver
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.options import Options from selenium.webdriver.firefox.options import Options
#from selenium.webdriver.common.action_chains import ActionChains
import json import json
""" """
@ -22,21 +21,13 @@ So I assume YouTube UI pagination doesn't work fine, so to retrieve all media fi
We could verify the `trackId` or `viperId` to avoid downloading other media files containing the provided title. We could verify the `trackId` or `viperId` to avoid downloading other media files containing the provided title.
""" """
#actions = ActionChains(browser)
with open('music.json') as json_file: with open('music.json') as json_file:
tracks = json.load(json_file) tracks = json.load(json_file)
for track in tracks: for track in tracks:
#browser.find_element(By.ID, 'text-input').click()
#browser.find_element(By.ID, 'text-item-2').click()
#actions.send_keys(track['title'])
#ctions.perform()
browser.find_element(By.ID, 'text-input').send_keys(track['title']) browser.find_element(By.ID, 'text-input').send_keys(track['title'])
browser.find_element(By.XPATH, '/html/body/ytcp-text-menu/tp-yt-paper-dialog/tp-yt-paper-listbox/tp-yt-paper-item[2]/ytcp-ve/div/div/yt-formatted-string/span[1]').click() browser.find_element(By.XPATH, '/html/body/ytcp-text-menu/tp-yt-paper-dialog/tp-yt-paper-listbox/tp-yt-paper-item[2]/ytcp-ve/div/div/yt-formatted-string/span[1]').click()
#browser.find_element(By.XPATH, '/html/body/ytcp-filter-dialog/tp-yt-paper-dialog/div[2]/ytcp-button/div').click()
number_of_results = int(browser.find_element(By.CSS_SELECTOR, '.page-description').get_attribute('innerHTML').split()[-1]) number_of_results = int(browser.find_element(By.CSS_SELECTOR, '.page-description').get_attribute('innerHTML').split()[-1])
print(number_of_results) print(number_of_results)