|
@@ -4,6 +4,7 @@ import random
|
|
|
import string
|
|
|
import requests
|
|
|
from bs4 import BeautifulSoup
|
|
|
+import time
|
|
|
|
|
|
|
|
|
def randomString(stringLength=10):
|
|
@@ -32,14 +33,24 @@ def download_mp4(url):
|
|
|
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36'}
|
|
|
with open('ai_spokesgirl.mp4','wb') as f:
|
|
|
r = requests.get(url, headers=headers, stream=True)
|
|
|
+ if r.status_code == 404:
|
|
|
+ return False
|
|
|
for chunk in r.iter_content(chunk_size=1024):
|
|
|
if chunk:
|
|
|
f.write(chunk)
|
|
|
+ return True
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- fname=mp3_to_anchor('/Users/zooeytsai/Downloads/p3r68-cdx67 6/osi6k-0qc1h.mp3')
|
|
|
+ fname=mp3_to_anchor('/Users/zooeytsai/kw_tools/openshot/input/movie_main/Q8.mp3')
|
|
|
print(fname)
|
|
|
- download_mp4(fname)
|
|
|
+ time.sleep(240)
|
|
|
+ while True:
|
|
|
+ result = download_mp4(fname)
|
|
|
+ if result:
|
|
|
+ break
|
|
|
+ print('等待...')
|
|
|
+ time.sleep(60)
|
|
|
+
|
|
|
|
|
|
|