Switched from geckodriver to chrome
This commit is contained in:
		| @@ -26,5 +26,4 @@ local_storage_path: /app/containerdata/files | ||||
| debug_storage_path: /app/containerdata/debug/ | ||||
| default_download_path: /app/containerdata/tmp | ||||
| remote_storage_path: /helbing_support/Files RM/Archiving | ||||
| browser_profile_path: /app/containerdata/dependencies/7hlyfqxt.Auto News | ||||
| blacklisted_href_domains: ["google.", "facebook."] | ||||
| browser_profile_path: /user_data/news_fetch.profile | ||||
|   | ||||
							
								
								
									
										56
									
								
								misc/youtube_batch.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								misc/youtube_batch.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,56 @@ | ||||
| import youtube_dl | ||||
| from waybackpy import WaybackMachineSaveAPI # upload to archive.org | ||||
| import time | ||||
|  | ||||
|  | ||||
| urls = [ | ||||
|     "https://www.youtube.com/watch?v=R4h_yiDIuQE", | ||||
|     "https://www.youtube.com/watch?v=-G8ZI1Jq8xA", | ||||
|     "https://www.youtube.com/watch?v=8eYBcASQIQI", | ||||
|     "https://www.thingiverse.com/thing:5463267", | ||||
|     "https://www.youtube.com/watch?v=cJoUSHJcV4E&t=0s", | ||||
|     "https://www.youtube.com/watch?v=UbBYZZBREBA&t=0s", | ||||
|     "https://www.youtube.com/watch?v=bQQn_vET4ys", | ||||
|     "https://www.youtube.com/watch?v=6FqNctiO06E", | ||||
|     "https://www.youtube.com/watch?v=ImnuJgj8XJo", | ||||
|     "https://www.youtube.com/watch?v=4QZQtSqaC34", | ||||
|     "https://www.youtube.com/watch?v=cW4qIjPMGkQ", | ||||
|     "https://www.youtube.com/watch?v=QWsUGpKfP8A", | ||||
|     "https://www.youtube.com/watch?v=a0PwEwLG9No", | ||||
|     "https://www.youtube.com/watch?v=Hd3lnWVIIpo", | ||||
|     "https://www.youtube.com/watch?v=JNtdAp-BdzI", | ||||
|     "https://en.wikipedia.org/wiki/Viktor_Schauberger", | ||||
|     "https://de.wikipedia.org/wiki/Viktor_Schauberger", | ||||
| ] | ||||
| def post_download_hook(ret_code): | ||||
|     # print(ret_code) | ||||
|     if ret_code['status'] == 'finished': | ||||
|         file_loc = ret_code["filename"] | ||||
|         print(file_loc) | ||||
|  | ||||
|  | ||||
| def save_video(url): | ||||
|     """Saves video accoring to url and save path""" | ||||
|     ydl_opts = { | ||||
|         'format': 'best[height<=720]', | ||||
|         # 'outtmpl': f"{file_path}.%(ext)s", # basically the filename from the object, but with a custom extension depending on the download | ||||
|         'progress_hooks': [post_download_hook], | ||||
|         'updatetime': False | ||||
|     } | ||||
|     try: | ||||
|         with youtube_dl.YoutubeDL(ydl_opts) as ydl: | ||||
|             ydl.download([url]) | ||||
|             # article file name is updated in self.post_download_hook | ||||
|     except Exception as e: | ||||
|         print(f"Youtube download crashed: {e}") | ||||
|  | ||||
|  | ||||
| # for url in urls: | ||||
| #     save_video(url) | ||||
|  | ||||
| for url in urls: | ||||
|     user_agent = "Mozilla/5.0 (Windows NT 5.1; rv:40.0) Gecko/20100101 Firefox/40.0" # needed? | ||||
|     wayback = WaybackMachineSaveAPI(url, user_agent) | ||||
|     archive_url = wayback.save() | ||||
|     print(archive_url) | ||||
|     time.sleep(20) | ||||
		Reference in New Issue
	
	Block a user