TheaterTrailers icon indicating copy to clipboard operation
TheaterTrailers copied to clipboard

some trailers requiere being 18 years old

Open hectorzin opened this issue 2 years ago • 1 comments

look for this errror, how can it be fixed?

2022-04-07 13:30:12,987 - INFO - downloading The Unbearable Weight of Massive Talent from RggMxPaoQSc [youtube] RggMxPaoQSc: Downloading webpage [youtube] RggMxPaoQSc: Refetching age-gated info webpage WARNING: unable to download video info webpage: HTTP Error 410: Gone ERROR: Sign in to confirm your age This video may be inappropriate for some users. Traceback (most recent call last): File "theaterTrailers.py", line 231, in updateCache if jsonDict[passedSmallTitle]['url'] == string: KeyError: 'theunbearableweightofmassivetalent'

hectorzin avatar Apr 07 '22 11:04 hectorzin

Solved:

The solution is to pass a cookie to YouTube as part of the download process in YouTube-DL. I was able to accomplish that with the following steps.

I installed the Get Cookies extension in Chrome. This extension allows users to export cookies for a site as a text file. I then visited YouTube.com, while I was logged in, and clicked on the Get Cookies icon. Then I clicked on the “Export” button to download my YouTube cookies as a text file. This created a youtube.com_cookies.txt file that I then copied into the theatertrailers folder

i Modified this in the theatertrailers.py file

Downloads the video, names it and copies the resources to the folder

def videoDownloader(string, passedTitle, yearVar):

Options for the video downloader

ydl1_opts = { 'outtmpl': os.path.join(TheaterTrailersHome, 'Trailers', '{0} ({1})'.format(passedTitle, yearVar), '{0} ({1}).mp4'.format(passedTitle, yearVar)), 'ignoreerrors': True, 'format': 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best', 'cookiefile': os.path.join(TheaterTrailersHome,'youtube.com_cookies.txt'), }

The cookiefile line is what I added

hectorzin avatar Apr 07 '22 12:04 hectorzin