Upload files to ''
This commit is contained in:
parent
c168a615eb
commit
9f38d6d492
4 changed files with 190 additions and 0 deletions
50
1.py
Normal file
50
1.py
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
|
||||||
|
x = 0
|
||||||
|
spisok = []
|
||||||
|
spisokNomber = []
|
||||||
|
spisokTime = []
|
||||||
|
spisokSlov = []
|
||||||
|
itog = []
|
||||||
|
|
||||||
|
with open("test.txt", "r") as file1:
|
||||||
|
for line in file1:
|
||||||
|
spisok.append(line)
|
||||||
|
nomber = int(spisok.index(line)) + 1
|
||||||
|
spisokNomber.append(nomber)
|
||||||
|
|
||||||
|
if nomber % 2 == 0:
|
||||||
|
print('Четное число')
|
||||||
|
spisokSlov.append(line)
|
||||||
|
|
||||||
|
else:
|
||||||
|
print('Нечентное число')
|
||||||
|
spisokTime.append(line.split())
|
||||||
|
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
num = spisokNomber[x]
|
||||||
|
itog.append(num)
|
||||||
|
|
||||||
|
strokaTime = "00:" + str(spisokTime[x])[2:-2] + ",001" + " --> " + "00:" + str(spisokTime[x + 1])[2:-2] + ",001"
|
||||||
|
itog.append(strokaTime)
|
||||||
|
|
||||||
|
slova = str(spisokSlov[x])
|
||||||
|
itog.append(slova)
|
||||||
|
|
||||||
|
x = x + 1
|
||||||
|
|
||||||
|
except:
|
||||||
|
itog = itog[:-1]
|
||||||
|
print("Конец!")
|
||||||
|
|
||||||
|
print(itog)
|
||||||
|
|
||||||
|
|
||||||
|
f = open("777.srt", 'w')
|
||||||
|
for item in itog:
|
||||||
|
f.write("%s\n" % item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
47
parser01.py
Normal file
47
parser01.py
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
import requests
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
link_sp = []
|
||||||
|
|
||||||
|
arg = sys.argv[1:]
|
||||||
|
arg2 = arg[0].replace(" ", "+")
|
||||||
|
print(arg2)
|
||||||
|
|
||||||
|
x = 1
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if x == 1:
|
||||||
|
url = "https://filmot.com/search/" + str(arg2) + "/1/?"
|
||||||
|
|
||||||
|
else:
|
||||||
|
url = "https://filmot.com/search/" + str(arg2) + "/1/" + str(x) + "?"
|
||||||
|
|
||||||
|
request = requests.get(url)
|
||||||
|
|
||||||
|
soup = BeautifulSoup(request.text, "html.parser")
|
||||||
|
|
||||||
|
teme = soup.find("div", {"id": "videoresults"})
|
||||||
|
|
||||||
|
for temes in teme:
|
||||||
|
temes = temes.find("img")
|
||||||
|
if "https://img.youtube.com/" in str(temes):
|
||||||
|
link = temes.get('src')
|
||||||
|
it_link = "https://www.youtube.com/watch?v=" + str(link[27: 38])
|
||||||
|
link_sp.append(it_link)
|
||||||
|
|
||||||
|
x = x + 1
|
||||||
|
if x == 4:
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
with open("link.txt", "w") as file:
|
||||||
|
print(*link_sp, file=file, sep="\n")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
67
parser02.py
Normal file
67
parser02.py
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
|
||||||
|
from selenium import webdriver
|
||||||
|
from selenium.webdriver.common.keys import Keys
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
from selenium.webdriver.support.ui import WebDriverWait
|
||||||
|
from selenium.webdriver.support import expected_conditions as EC
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
url = sys.argv[1]
|
||||||
|
|
||||||
|
driver = webdriver.Firefox()
|
||||||
|
driver.get(url)
|
||||||
|
|
||||||
|
time.sleep(7)
|
||||||
|
|
||||||
|
try:
|
||||||
|
element = driver.find_element(By.XPATH, """html/body/c-wiz/div/div/div/div[2]/div[1]/div[3]/div[1]/form[2]/div/div/button""")
|
||||||
|
element.click()
|
||||||
|
|
||||||
|
except:
|
||||||
|
element = driver.find_element(By.XPATH, """/html/body/ytd-app/ytd-consent-bump-v2-lightbox/tp-yt-paper-dialog/div[4]/div/div[6]/div[1]/ytd-button-renderer[2]""")
|
||||||
|
element.click()
|
||||||
|
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
element = driver.find_element(By.XPATH, """/html/body/ytd-app/div[1]/ytd-page-manager/ytd-watch-flexy/div[5]/div[1]/div/div[6]/div[1]/div[2]/ytd-video-primary-info-rinfo-renderer/div/div/div[3]/div/ytd-menu-renderer/yt-icon-button/button/yt-icon""")
|
||||||
|
element.click()
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
|
||||||
|
except:
|
||||||
|
element = driver.find_element(By.CSS_SELECTOR, """ytd-menu-renderer.ytd-video-primary-info-renderer > yt-icon-button:nth-child(3) > button:nth-child(1)""")
|
||||||
|
element.click()
|
||||||
|
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
|
||||||
|
element = driver.find_element(By.XPATH, """/html/body/ytd-app/ytd-popup-container/tp-yt-iron-dropdown/div/ytd-menu-popup-renderer/tp-yt-paper-listbox/ytd-menu-service-item-renderer/tp-yt-paper-item""")
|
||||||
|
element.click()
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
|
try:
|
||||||
|
element = driver.find_element(By.XPATH, """/html/body/ytd-app/div[1]/ytd-page-manager/ytd-watch-flexy/div[5]/div[1]/div/div[2]/ytd-engagement-panel-section-list-renderer[4]/div[2]/ytd-transcript-renderer/div[2]/ytd-transcript-search-panel-renderer/div[2]/ytd-transcript-segment-list-renderer""")
|
||||||
|
print(element.text)
|
||||||
|
|
||||||
|
text = element.text
|
||||||
|
|
||||||
|
z = open('test.txt', 'w')
|
||||||
|
z.write(text)
|
||||||
|
z.close
|
||||||
|
|
||||||
|
g = open('prov.txt', 'w')
|
||||||
|
g.write("sss")
|
||||||
|
g.close
|
||||||
|
|
||||||
|
except:
|
||||||
|
print("111")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
26
start.sh
Normal file
26
start.sh
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
read search
|
||||||
|
python3 parser01.py "$search"
|
||||||
|
file="/home/q/Programms/videogrep/Triangle/link.txt"
|
||||||
|
IFS=$'\n'
|
||||||
|
for var in $(cat $file)
|
||||||
|
|
||||||
|
do
|
||||||
|
echo "Proverka_NO" > prov.txt
|
||||||
|
python3 parser02.py $var
|
||||||
|
|
||||||
|
file2="prov.txt"
|
||||||
|
if [ $(cat $file2) = "sss" ]
|
||||||
|
then
|
||||||
|
python3 "1.py"
|
||||||
|
yt-dlp $var -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" -o "777.mp4"
|
||||||
|
videogrep --input "777.mp4" --search "$search"
|
||||||
|
mv supercut.mp4 file-$(date +%Y-%m-%d:%k:%M:%S).mp4
|
||||||
|
rm "777.mp4"
|
||||||
|
fi
|
||||||
|
pkill -f firefox
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue