Embeded Youtube video unavailable Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Embeded Youtube video unavailable

16 Feb 2020, 09:32

is there a workaround for this error, I've tried several scripts but all lead me to the same error

Code: Select all

id=_zABLecsR5UE
fx=https://www.youtube.com/embed/zABLecsR5UE?autoplay=1
;fx:="https://autohotkey.com/boards/"

xxa=Mozilla.Browser                  ;- firefox
Gui Add, ActiveX, w980 h640 vWB,%xxa%
WB.Silent := True
WB.Navigate(fx)
Gui, Show,,YOUTUBE
return
Guiclose:
exitapp

Thanks for any help given

**edit** I am assuming this is a non-starter looks like youtube blocks it unless running through youtube website itself
garry
Posts: 3778
Joined: 22 Dec 2013, 12:50

Re: Embeded Youtube video unavailable  Topic is solved

16 Feb 2020, 15:18

a script from geekdude

Code: Select all

;- from user geekdude 20120107
;=============== SCRIPT YOUTUBE PLAY / BROWSER =========
id=eKZhI2r9J8U
url=https://www.youtube.com/embed/%id%?autoplay=1
 
;MsgBox, 4,, Fix IE?
;IfMsgBox, Yes
    Fix := True
 
Gui Add, Edit, w930 r1 vURL, %Url%
Gui Add, Button, x+6 yp-1 w44, Go
 
if Fix
    Prev := FixIE()
Gui Add, ActiveX, xm w980 h640 vWB, Shell.Explorer
;WB.Silent := True
WB.Navigate(URL)
if Fix
    FixIE(Prev)
ComObjConnect(WB, WB_events)
Gui Show
return
;-------------------
ButtonGo:
Gui Submit, NoHide
WB.Navigate(URL)
return 
;-------------------
Guiclose:
WB.Document.close
WB := ""
exitapp
;-------------------
class WB_events
{
    NavigateComplete2(wb, NewURL)
    {
        try
            if wb.LocationUrl
                GuiControl,, URL, % wb.LocationUrl
    }
}
return
;---------------------------------------------------------
FixIE(Version=0, ExeName="")
{
	static Key := "Software\Microsoft\Internet Explorer"
	. "\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION"
	, Versions := {7:7000, 8:8888, 9:9999, 10:10001, 11:11001}
	
	if Versions.HasKey(Version)
		Version := Versions[Version]
	
	if !ExeName
	{
		if A_IsCompiled
			ExeName := A_ScriptName
		else
			SplitPath, A_AhkPath, ExeName
	}
	
	RegRead, PreviousValue, HKCU, %Key%, %ExeName%
	if (Version = "")
		RegDelete, HKCU, %Key%, %ExeName%
	else
		RegWrite, REG_DWORD, HKCU, %Key%, %ExeName%, %Version%
	return PreviousValue
}
;======================= END SCRIPT YOUTUBE PLAY / BROWSER =========
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Re: Embeded Youtube video unavailable

16 Feb 2020, 15:24

Thanks, Garry, I tried this once and didn't get it to go, I now realize why. if I paste the URL in the search box it works, but if I paste the id in the script it doesn't.
gives me something to work with.
you don't know if ads can be blocked do you?
User avatar
flyingDman
Posts: 2828
Joined: 29 Sep 2013, 19:01

Re: Embeded Youtube video unavailable

16 Feb 2020, 15:44

It works fine here. I added:

Code: Select all

gui, margin, 0,0
gui, -caption -DPIScale
Thx @garry and @GeekDude
14.3 & 1.3.7
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Re: Embeded Youtube video unavailable

16 Feb 2020, 15:52

ah, no sorry it works, what im saying is if i replace the id with id=zABLecsR5UE then i get the unavailable error
if i paste the url when the script runs it gives a script error at line 8319 , but click yes in the box it starts playing after the ads

seems if i remove the; from WB.Silent := True i get no script error at 8319
garry
Posts: 3778
Joined: 22 Dec 2013, 12:50

Re: Embeded Youtube video unavailable

17 Feb 2020, 05:23

with id=zABLecsR5UE i get the unavailable error
script above works , but this link not , maybe not allowed some links from youtube embed or frame ...
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Re: Embeded Youtube video unavailable

17 Feb 2020, 10:10

yea they only don't work if the code is put in the script, but if the script is running already they work fine, just the ads show up
garry
Posts: 3778
Joined: 22 Dec 2013, 12:50

Re: Embeded Youtube video unavailable

17 Feb 2020, 16:38

I use adblocker in Firefox and Chrome uBlockOrigin , but here in ahk script activeX not works
here is a Internetbrowser script with DropDownList , I can't start your video 'Lewis Capaldi' , other worked

Code: Select all

;- Internetbrowser play also Youtube-Video
;- Modified=20200217
;- Created =20200217

#warn
#NoEnv              ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input      ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode 2
SetBatchLines, -1
CoordMode, Mouse , Relative  ;- GUI
DetectHiddenWindows, On

filename1=InternetBrowser  
title:=""
lasttitle:=""

Gui,3:default
Gui,3: -DPIScale
SS_REALSIZECONTROL := 0x40
Gui,3:color,black,black
wa:=A_screenwidth
ha:=A_screenHeight
xx:=100
;- maybe change fontsize
;============ GUISIZEx DPIx 4Kx 3840*2160 is 100% ============
if (wa=3840)
  Gui,3:Font,s14 cYellow,Lucida Console

;============ GUISIZEx DPIx FHD 1920*1080 is 100% ============
if (wa=1920)
 Gui,3:Font,s12 cYellow,Lucida Console
;=============================================================

xxa=Shell.Explorer      ;- IExplorer
;xxa=Mozilla.Browser    ;- Mozilla Firefox

transform,s,chr,32
e5x=
(Ltrim join|
Lilian de Celis - ElRelicario                     ,https://www.youtube.com/embed/eKZhI2r9J8U?autoplay=1
Lewis Capaldi - Someone You Loved                 ,https://www.youtube.com/embed/zABLecsR5UE
Gloria Lasso Etranger au paradies                 ,https://www.youtube.com/embed/l9lw-zQcZ58?autoplay=1
Li xiang lan - Ye lai xiang                       ,https://www.youtube.com/embed/iR0w0mWB3uA?autoplay=1
Grace Chang Ge Lan - Calypso                      ,https://www.youtube.com/embed/ZIfpCLrjXVU?autoplay=1
Felix FeFe Blog                                   ,http://blog.fefe.de/?css=
Autohotkey                                        ,https://www.autohotkey.com/
%s%
)


x:=(wa*.2)/xx,y:=(ha*.1)/xx,h:=(ha*2.4)/xx,w:=(wa*35)/xx
Gui,3: Add, Edit, x%x% y%y% w%w% h%h%  vURL,
x:=(wa*35.7)/xx,w:=(wa*1.5)/xx
Gui,3: Add, Button,x%x% y%y% w%w% h%h%  gBrB, <
x:=(wa*38)/xx,
Gui,3: Add, Button,x%x% y%y% w%w% h%h%  gBrF, >
x:=(wa*40)/xx,
Gui,3: Add, Button,x%x% y%y% w%w% h%h% Default gA1, Go
x:=(wa*44)/xx,h:=(ha*17)/xx,w:=(wa*20)/xx
Gui,3:Add,DDL,x%x% y%y% w%w% h%h% cBlack vUrlDDL gAA,%e5x%

Fix := True
if Fix
    Prev := FixIE()
x:=(wa*.2)/xx,y:=(ha*3)/xx,h:=(ha*59)/xx,w:=(wa*63)/xx
Gui,3: Add, ActiveX, w%w% h%h% x%x% y%y% vWB,%xxa%
WB.Silent := True
ComObjConnect(WB, WB_events)    ;- Connect WB's events to the WB_events class object.

x:=(wa*.2)/xx,y:=(ha*.2)/xx,h:=(ha*74)/xx,w:=(wa*65)/xx
Gui,3:show,x%x% y%y% w%w% h%h%,%filename1%

GuiControl,3: ChooseString,urlddl,Lewis
sleep,1000
gosub,aa
return
;-------------
;-----------------------------------------------------
3Guiescape:
3GuiClose:
WB.Document.close
WB := ""
exitapp
;-----------------------------------------------------


aa:
Gui,3: submit, nohide
h1:=""
h2:=""
if urlDDL<>
   {
   StringSplit,h,urlddl, `,
   Guicontrol,3:,url,%h2%
WB.Navigate(h2)
if Fix
    FixIE(Prev)
   }
return


a1:
Gui,3: Submit, NoHide

try 
{
WB.Navigate(URL)
}
catch e
{
xxx:=e.Message
msgbox, 262208,ERROR,Error=`n%xxx%`n------------------------------------------`n
return
}return
;-----------
Brb:
try{WB.GoBack()
}catch e{
;xxx:=e.Message
;msgbox, 262208,ERROR,Error=`n%xxx%`n------------------------------------------`n
return
}
return
;--------------------
BrF:
try{WB.GoForward()
}catch e{
;xxx:=e.Message
;msgbox, 262208,ERROR,Error=`n%xxx%`n------------------------------------------`n
return
}
return
;-------------------
class WB_events
{
NavigateComplete2(wb, NewURL)
  {
  GuiControl,3:, URL, %NewURL%  ;- Update the URL edit control.
  }
}
;----------------------

;- for play youtube
FixIE(Version=0, ExeName="")
{
	static Key := "Software\Microsoft\Internet Explorer"
	. "\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION"
	, Versions := {7:7000, 8:8888, 9:9999, 10:10001, 11:11001}
	
	if Versions.HasKey(Version)
		Version := Versions[Version]
	
	if !ExeName
	{
		if A_IsCompiled
			ExeName := A_ScriptName
		else
			SplitPath, A_AhkPath, ExeName
	}
	RegRead, PreviousValue, HKCU, %Key%, %ExeName%
	if (Version = "")
		RegDelete, HKCU, %Key%, %ExeName%
	else
		RegWrite, REG_DWORD, HKCU, %Key%, %ExeName%, %Version%
	return PreviousValue
}
return

;-----------------------------------------------------
;=============================================================
markc63
Posts: 48
Joined: 01 Feb 2020, 14:20

Re: Embeded Youtube video unavailable

18 Feb 2020, 10:11

yea I don't think it will work, a thought i had was a couple of scripts you posted in the radio thread and that was to create a script that reads the listing from the
this script below and then takes the artist and title, searches youtube for an url, which then pastes in the youtube downloader script to download it in the background, still using the first script to create a playlist which plays the videos in sequence creating a video music station, obviously if the video file is found within a folder it is reused

i know it sounds kinda mad, but kinda good entertainment

Code: Select all

;- Example shows played songs from :
;- https://www.internet-radio.com/stations/50s/

;MODIFIED =20200205
;CREATED  =20130104

#warn
#NoTrayIcon
setworkingdir,%a_scriptdir%
Filename1=Internet Radio  ( use ESC for MUTE=ON/OFF )

f1:="http://144.217.253.136:8582/played.html"
f2=http://144.217.253.136:8582/

new:=""
vlcx        =%A_programfiles%\VideoLAN\VLC\vlc.exe
ifexist,%vlcx%
 run,%vlcx% --one-instance --qt-start-minimized %f2%,,hide,pid1

;--- Hotkey Escape for Mute ON/OFF -----------
HK1=Esc
  Hotkey,%hk1%,mute1,ON

xx:=ComObjCreate("WinHttp.WinHttpRequest.5.1")   ;-Create the Object
ComObjError(false)
xx.Silent := True    ;- script failure = off
xx.SetTimeouts(500,500,500,500)

Gui,2: Color, 000000
Gui,2:Font,  S10 CDefault , Lucida Console
Gui,2:Add,Text, cYellow x10  y10 h23  w680 vT1,
Gui,2:Add,Text, cGray   x10  y50 h170 w680 vT2
Gui,2: Show, x10 y1  w700 ,%filename1%
settimer,aa1,5000
gosub,aa1
return
;-----------------------
aa1:
new:=""
try {
    xx.Open("GET",f1)                           ;-Open communication
    xx.Send()                                   ;-Send the "get" request
    aac=
    aac:=xx.ResponseText                        ;-Set the "aac" variable to the response
    ;msgbox, 262208,%f1%--TEXT ,%aac%           ;- see TEXT from url
} catch e {
    xxx:=e.Message
    msgbox, 262208,ERROR ,Error=Catch`n%f1%`n NOT exists`n------------------------------------------`n%xxx%`n------------------------------------------,
    }
    StringReplace,y,aac,</tr>,$, All
    Loop,parse,y,$,
        {
        if A_loopfield contains Current Song
            {
            y:=RegExReplace( A_loopfield, "<.*?>" )
            stringreplace,y,y,Current Song,,all
            stringmid,y,y,9,200
            break
            }
        }
    y :=RegExReplace(y, "\W", " ")     ;- now playing
;-   all last played ---------------
StringReplace,aac,aac,</tr>,$, All
stringreplace,aac,aac,&nbsp;,,all
aac:=RegExReplace(aac, "<.*?>" )
Loop,parse,aac,$,
   new .= a_loopfield "`n"
;msgbox, 262208,PLAYED_SONGS,%new%
GuiControl,2:,T2,%new%
GuiControl,2:,T1 ,%y%      ;-- Current Text
;msgbox, 262208, ,%y%,2
return
;--------------------
MUTE1:
soundset,+1,master,mute
return
;--------------------
2Guiclose:
settimer,aa1,OFF
Process, Exist, vlc.exe
If ErrorLevel
   {
   msgbox, 262435,Radio-Close,Want you close also Audio ?
   ifmsgbox,NO
      {
      soundset,0,master,mute
      exitapp
      }
   ifmsgbox,Cancel
      {
      settimer,aa1,ON
      return
      }
   else
     {
     soundset,0,master,mute
     process,close,vlc.exe
     exitapp
     }
   }
else
  {
  soundset,0,master,mute
  exitapp
  }
return
;=================================================================

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: arielqco, Bing [Bot], koolestani, Marium0505, mikeyww and 94 guests