I had downloaded videos from the time when internet wasn't very fast here. So videos were downloaded in a lower resolution. This finds youtube URLs of all the videos kept in a folder and stored them in a CSV file. These links can then be put in a youtube downloader for batch download. I imported the CSV into 4K Youtube downloader to get all videos in high resolution in one go.
os, sys, re, requests, bs4 and subprocess
- Takes path of folder containing the videos. Default path is the folder in which program is stored.
- Creates a list of all video files in the folder.
- Removes any files with resolution 720p or above.
- Searches for remaining files on youtube and grabs the link of the first result.
- Stores the link (along with the name) in song_URL_list.csv file in the folder containing the videos.
- Minimum resolution, csv file name and video extensions can be changed from the variables in the beginning of the code.
- It should work but hasn't been tested with all the video container formats.
- res_flag can be set to False to grab links of all videos irrespective of resolution.
- Try setting res_flag to False if it doesn't work with some video format.
- Set file_flag to False if you don't need CSV file.
- All URLs are also stored in video_URLs variable, if required.