|
@@ -3,7 +3,6 @@ import numpy as np
|
|
|
import pandas as pd
|
|
|
import requests
|
|
|
import os
|
|
|
-from bs4 import BeautifulSoup
|
|
|
from selenium import webdriver
|
|
|
from selenium.webdriver.common.by import By
|
|
|
from selenium.webdriver.support.ui import WebDriverWait
|
|
@@ -11,6 +10,9 @@ from selenium.webdriver.support import expected_conditions as EC
|
|
|
from selenium.webdriver.common.keys import Keys
|
|
|
from selenium.common.exceptions import NoSuchElementException
|
|
|
from selenium_stealth import stealth
|
|
|
+import redis
|
|
|
+import json
|
|
|
+import random
|
|
|
|
|
|
profile_file = ['Profile 20', 'Profile 25']
|
|
|
|
|
@@ -104,9 +106,11 @@ def check_exists_by_xpath(driver, xpath):
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- urls = [
|
|
|
- 'https://www.youtube.com/watch?v=eFZckOTi24c',
|
|
|
- ]
|
|
|
+ r = redis.Redis(host='db.ptt.cx', port=6379, db=0, password='choozmo9')
|
|
|
+ js = r.get('yt_video')
|
|
|
+ jsobj = json.loads(js)
|
|
|
+ videoId = random.choice(jsobj)
|
|
|
+ urls = f"https://www.youtube.com/watch?v={videoId}"
|
|
|
|
|
|
# inp = open("url.txt", "r")
|
|
|
# for line in inp.readlines():
|