mirror of
https://github.com/buzz-lightsnack-2007/DownYouNow.git
synced 2024-08-14 23:55:22 +00:00
Added check_link feature.
- check_link feature ensures that the video is in a YouTube domain.
This commit is contained in:
parent
7ead6d173a
commit
524206104c
1 changed files with 52 additions and 42 deletions
|
@ -27,8 +27,7 @@
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"id": "tgACi8lLVS6Y",
|
"id": "tgACi8lLVS6Y"
|
||||||
"cellView": "form"
|
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
@ -131,8 +130,15 @@
|
||||||
" \n",
|
" \n",
|
||||||
" check_installDone('write')\n",
|
" check_installDone('write')\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def save_video(): \n",
|
"def check_link(): \n",
|
||||||
|
" # Check the link if it is in YouTube. \n",
|
||||||
|
" if ('.youtube.co' in user.video_link) or ('youtu.be' in user.video_link): \n",
|
||||||
|
" return True\n",
|
||||||
|
" else: \n",
|
||||||
|
" fail(formatting.font.bold + 'The link is not YouTube. ' + formatting.clear)\n",
|
||||||
|
" return False\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
"def save_video(): \n",
|
||||||
" import google;\n",
|
" import google;\n",
|
||||||
"\n",
|
"\n",
|
||||||
" try:\n",
|
" try:\n",
|
||||||
|
@ -171,10 +177,12 @@
|
||||||
" start_download((video.video_title + '.' + user.audio_format))\n",
|
" start_download((video.video_title + '.' + user.audio_format))\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Main. \n",
|
"# Main. \n",
|
||||||
"check_compatibility()\n",
|
"try: \n",
|
||||||
"cleanup()\n",
|
" check_compatibility()\n",
|
||||||
|
" cleanup()\n",
|
||||||
|
" check_link()\n",
|
||||||
"\n",
|
"\n",
|
||||||
"class user: \n",
|
" class user: \n",
|
||||||
" video_link = \"\" #@param {type:\"string\"}\n",
|
" video_link = \"\" #@param {type:\"string\"}\n",
|
||||||
" video_link = video_link.strip()\n",
|
" video_link = video_link.strip()\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
@ -189,9 +197,9 @@
|
||||||
" audio_format = 'm4a' #@param ['m4a']\n",
|
" audio_format = 'm4a' #@param ['m4a']\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"install_required()\n",
|
" install_required()\n",
|
||||||
"\n",
|
"\n",
|
||||||
"try: \n",
|
" try: \n",
|
||||||
" import yt_dlp;\n",
|
" import yt_dlp;\n",
|
||||||
" with yt_dlp.YoutubeDL({}) as ydl:\n",
|
" with yt_dlp.YoutubeDL({}) as ydl:\n",
|
||||||
" class video: \n",
|
" class video: \n",
|
||||||
|
@ -200,7 +208,7 @@
|
||||||
" video_id = info_dict.get(\"id\", None)\n",
|
" video_id = info_dict.get(\"id\", None)\n",
|
||||||
" video_title = info_dict.get('title', None)\n",
|
" video_title = info_dict.get('title', None)\n",
|
||||||
" output_format = '';\n",
|
" output_format = '';\n",
|
||||||
"except: \n",
|
" except: \n",
|
||||||
" import youtube_dl;\n",
|
" import youtube_dl;\n",
|
||||||
" with youtube_dl.YoutubeDL({}) as ydl:\n",
|
" with youtube_dl.YoutubeDL({}) as ydl:\n",
|
||||||
" class video: \n",
|
" class video: \n",
|
||||||
|
@ -210,8 +218,10 @@
|
||||||
" video_title = info_dict.get('title', None)\n",
|
" video_title = info_dict.get('title', None)\n",
|
||||||
" output_format = '';\n",
|
" output_format = '';\n",
|
||||||
"\n",
|
"\n",
|
||||||
"save_video()\n",
|
" save_video()\n",
|
||||||
"download_video()"
|
" download_video()\n",
|
||||||
|
"except: \n",
|
||||||
|
" info.fail(formatting.font.bold + 'An error has ocurred, ' formatting.clear + 'we apologize for the inconvenience. Please check the log for full details. ')"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue