ERROR: dP15zlyra3c: YouTube said: Unable to extract video data - python-3.x

I found the code below at Youtube download using Youtube-dl embedded with Python - 2020
After I ran pip3 list I saw youtube-dl 2020.3.24 in the list.
However, when I run...
# ydl1.py
from __future__ import unicode_literals
import youtube_dl
ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download(['https://www.youtube.com/watch?v=dP15zlyra3c'])
I see the following error...
[youtube] dP15zlyra3c: Downloading webpage
ERROR: dP15zlyra3c: YouTube said: Unable to extract video data
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 797, in extract_info
ie_result = ie.extract(url)
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/common.py", line 530, in extract
ie_result = self._real_extract(url)
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1788, in _real_extract
raise ExtractorError(
youtube_dl.utils.ExtractorError: dP15zlyra3c: YouTube said: Unable to extract video data
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "ydl1.py", line 7, in <module>
ydl.download(['https://www.youtube.com/watch?v=dP15zlyra3c'])
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 2018, in download
res = self.extract_info(
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 820, in extract_info
self.report_error(compat_str(e), e.format_traceback())
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 625, in report_error
self.trouble(error_message, tb)
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 595, in trouble
raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR: dP15zlyra3c: YouTube said: Unable to extract video data
y#y-peppy:~/.config/autokey$
What am I doing wrong?

Updating youtube-dl. Depending on the way you installed it, here are the commands:(in windows)
1-youtube-dl --update (self-update)
2-pip install -U youtube-dl (via python)
3-choco upgrade youtube-dl (Windows + Chocolatey)
and a cookies.txt file can be created with the "cookies.txt" extension.
Do this while being logged in to YouTube.
for example :
For Firefox:
this
For Chrome:this
Then run youtube-dl like this:
youtube-dl.exe --cookies C:\Users\tezJR\Downloads\cookies-txt https://www.youtube.com/watch?v=$VIDEO-ID
adjust that command to where your cookies.txt file is actually located and replace $VIDEO-ID with the ID of your restricted video

Related

Python yt-dlp and ffmpeg error "merging of multiple formats but ffmpeg is not installed"

I am using last version of yt-dlp with Python3.9
I am trying to download a youtube video in mp4 format with outputname as the youtubeid.mp4 and with best resolution no more than 4K...
I have tried this :
ytid = '4cDqaLxrt6Q'
url = 'https://www.youtube.com/watch?v='+ytid
output_filename = ytid+".mp4"
with YoutubeDL({'format': 'bestvideo[height<=?4K]+bestaudio/best', 'output': output_filename}) as ydl:
ydl.download(url)`#TODO debug FFmpeg and check if outputname is ok
I was expecting to have a .mp4 file in my current working directory...
Then, I have installed last release of FFmpeg from ffmpeg-master-latest-win64-gpl.zip and put ffmpeg.exe , ffplay.exe and ffprobe.exe in Scripts python folder (where there is yt-dlp.exe). ZAnd I have also installed ffmpeg with pip install.
The Traceback is
[youtube] Extracting URL: https://www.youtube.com/watch?v=4cDqaLxrt6Q
[youtube] 4cDqaLxrt6Q: Downloading webpage
[youtube] 4cDqaLxrt6Q: Downloading android player API JSON
[youtube] 4cDqaLxrt6Q: Downloading MPD manifest
[youtube] 4cDqaLxrt6Q: Downloading MPD manifest
[info] 4cDqaLxrt6Q: Downloading 1 format(s): 243+251
ERROR: You have requested merging of multiple formats but ffmpeg is not installed. Aborting due to --abort-on-error
Traceback (most recent call last):
File "C:\Users\t\OneDrive\Documents\Python Scripts\project\main.py", line 88, in
ydl.download(url)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 3353, in download
self.__download_wrapper(self.extract_info)(
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 3328, in wrapper
res = func(*args, **kwargs)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 1486, in extract_info
return self.__extract_info(url, self.get_info_extractor(key), download, extra_info, process)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 1497, in wrapper
return func(self, *args, **kwargs)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 1594, in __extract_info
return self.process_ie_result(ie_result, download, extra_info)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 1653, in process_ie_result
ie_result = self.process_video_result(ie_result, download=download)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 2767, in process_video_result
self.process_info(new_info)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 3189, in process_info
self.report_error(f'{msg}. Aborting due to --abort-on-error')
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 1007, in report_error
self.trouble(f'{self._format_err("ERROR:", self.Styles.ERROR)} {message}', *args, **kwargs)
File "C:\Users\t\anaconda3\lib\site-packages\yt_dlp\YoutubeDL.py", line 947, in trouble
raise DownloadError(message, exc_info)
DownloadError: ERROR: You have requested merging of multiple formats but ffmpeg is not installed. Aborting due to --abort-on-error
You have two ways:
As a workaround, check your system path in Powershell, running: $Env:Path
Put all three executables ff* in one of the listed paths.
Best way, put all three executables in a folder of your choice and then add that path in Windows env PATH. How to do that depends on your Windows version; check Settings, search in for environment variables.

Python3 ArcPy path/permissions setting error sd Hosted Services

Traceback (most recent call last):
File "<string>", line 34, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\mp.py", line 105, in CreateWebLayerSDDraft
return _convertArcObjectToPythonObject(arcgisscripting._mapping.CreateWebLayerSDDraft(*_gp_fixargs([map_or_layers, out_sddraft, service_name, server_type, service_type, folder_name, overwrite_existing_service, copy_data_to_server, enable_editing, allow_exporting, enable_sync, summary, tags, description, credits, use_limitations], True)))
ValueError: Staging path is invalid or inaccessible: C:\Users\hagerty_finn\Documents\ArcGIS\Projects\TrafficFatalityCount\temp.txt
Line 34:
arcpy.mp.CreateWebLayerSDDraft(mp, sddraft, sd_fs_name, 'MY_HOSTED_SERVICES', 'FEATURE_ACCESS')
I tried changing the file path to another user and updating the password. The problem persists. I am running this script in ArcGIS Pro Python window on a GIS local server.

How can error GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown be fixed?

I'm trying to customize Ubuntu 22.04. But then i'm entering
sudo gnome-tweaks
it returns
WARNING : Error getting shell mode
CRITICAL: Error getting shell version
WARNING : Could not list shell extensions
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/gtweak/tweaks/tweak_group_appearance.py", line 144, in __init__
extensions = self._shell.list_extensions()
File "/usr/lib/python3/dist-packages/gtweak/gshellwrapper.py", line 76, in list_extensions
return self._proxy.proxy_extensions.ListExtensions()
File "/usr/lib/python3/dist-packages/gi/overrides/Gio.py", line 349, in __call__
result = self.dbus_proxy.call_sync(self.method_name, arg_variant,
gi.repository.GLib.GError: g-dbus-error-quark: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.Shell was not provided by any .service files (2)
Gnome-tweaks opens, but... If i change some parameters in gnome-tweaks, it does just nothing! What can I do with it?

Speech recognition library is giving error of input device

I am doing voice recognition using python library "Speech Recognition",Every thing is going well with audio files but when i use mike, it is showing this error.
Traceback (most recent call last):
File "StoTUsingMike.py", line 5, in <module>
with sr.Microphone() as source:
File "/home/nash/.local/lib/python3.5/site-packages/speech_recognition/__init__.py", line 86, in __init__
device_info = audio.get_device_info_by_index(device_index) if device_index is not None else audio.get_default_input_device_info()
File "/usr/local/lib/python3.5/dist-packages/pyaudio.py", line 949, in get_default_input_device_info
device_index = pa.get_default_input_device()
OSError: No Default Input Device Available
I have seen 2 or 3 more posts regarding this error on stack overflow but there is no clear solution.
Kindly help me out of this problem.

pexpect telnet on windows

I've used pexpect on linux successfully to telnet/ssh into Cisco switches for CLI scrapping. I'm trying to convert this code over to Windows and having some issues since it doesn't support the pxpect.spawn() command.
I read some online documentation and it suggested to use the pexpect.popen_spawn.PopenSpawn command. Can someone please point to me what I'm doing wrong here? I removed all my exception handling to simplify the code. Thanks.
import pexpect
from pexpect.popen_spawn import PopenSpawn
child = pexpect.popen_spawn.PopenSpawn('C:/Windows/System32/telnet 192.168.1.1')
child.expect('Username:')
child.sendline('cisco')
child.expect('Password:')
child.sendline('cisco')
child.expect('>')
child.close()
Error:
Traceback (most recent call last):
File "C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\site-packages\pexpect\expect.py", line 98, in expect_loop
incoming = spawn.read_nonblocking(spawn.maxread, timeout)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\site-packages\pexpect\popen_spawn.py", line 68, in read_nonblocking
raise EOF('End Of File (EOF).')
pexpect.exceptions.EOF: End Of File (EOF).
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python\windows scripts\telnet\telnet.py", line 37, in <module>
main()
File "C:\Python\windows scripts\telnet\telnet.py", line 20, in main
child.expect('Username:')
File "C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\site-packages\pexpect\spawnbase.py", line 327, in expect
timeout, searchwindowsize, async_)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\site-packages\pexpect\spawnbase.py", line 355, in expect_list
return exp.expect_loop(timeout)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\site-packages\pexpect\expect.py", line 104, in expect_loop
return self.eof(e)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\site-packages\pexpect\expect.py", line 50, in eof
raise EOF(msg)
pexpect.exceptions.EOF: End Of File (EOF).
<pexpect.popen_spawn.PopenSpawn object at 0x000000000328C550>
searcher: searcher_re:
0: re.compile("b'Username:'")
The solution is to use plink.exe, which is a part of putty installation. You can download it from https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
Enable TelnetClient on windows system and put plink.exe in the same folder from where you are running pexpect. Then you can telnet using pexpect as mentioned in the below example.
Also, use timeout flag with PopenSpawn to wait for the connection to establish. The above error is due to a timeout flag is not set.
p = pexpect.popen_spawn.PopenSpawn('plink.exe -telnet 192.168.0.1 -P 23', timeout=1)

Resources