Jump to content
Sign in to follow this  

_ie function to choose Referrer

Recommended Posts


Hi. I am trying to create an embedded ie window and have successfully done so. First I change the site to google.com (need to navigate before i can write html to the embedded window) Then i use _IEDocWriteHTML to make an embedded youtube link. The problem is I get an error when trying to play the song ->

 this video contains content from vevo. it is restricted from playback on certain sites

So I tried googling this and it seems like I need to specify a Referer or youtube will block me(on certain videos)

I once again turned to google and found this thread https://www.autoitscript.com/forum/topic/165108-ie-referrer/  and this snippet of code 

$oIE.Navigate2("http://whatismyreferer.com", Default, Default, Default, 'Referer: "newwebsite.com"')

but I am not quite sure what I should fill in here. I have never heard of referer before this problem occoured, but isn't it what tells youtube where the user watching the video came from? how can i specify this when it is just a script running?

this is the code i use to build the html i use to create the embedded link to youtube

local $buildHtml = ""
    $buildHtml &= "<head>" & @CRLF
    $buildHtml &= "<body>" & @CRLF
    $buildHtml &= '<iframe width="300" height="300" src="https://www.youtube.com/embed/'& $split[1] &'?rel=0&amp;showinfo=1" frameborder="0" allowfullscreen></iframe>'
    $buildHtml &= "</body>" & @CRLF
    $buildHtml &= "</head>" & @CRLF

split[1] contains the id of the video. I would like some help to how I can resolve this and maybe an answer to if my understanding of a referer is correct(and/or maybe a more in depth answer)? 

Edited by TheOnlyOne

Share this post

Link to post
Share on other sites

bump(I know it hasn't been 24 hours but I thought it was ok since there was all this spam yesterday and my post pretty much got buried )

Share this post

Link to post
Share on other sites

uhm yea, pretty much like this

#include <ie.au3>

$buildHtml = ""
$buildHtml &= "<HTML>" & @CRLF
$buildHtml &= "<BODY>" & @CRLF
$buildHtml &= '<iframe width="560" height="315" src="https://www.youtube.com/embed/QcIy9NiNbmo?rel=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>' & @CRLF
$buildHtml &= "</BODY>" & @CRLF
$buildHtml &= "</HTML>"

$gui = GUICreate("",300,300,-1,-1)
$ie = _IECreateEmbedded()
_IEAction($ie, "refresh")



Share this post

Link to post
Share on other sites

Nvm I found a solution. By chaning the _ienavigate to youtube.com it will allow me to see the embedded video.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • gahhon
      By gahhon
      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\..\Downloads\ALlogo.ico #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_HiDpi=y #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /rm /pe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** I found out that a lot of sources provided by AutoIT members like what I am recently using is the Metro UDF.
      On top of it, it always written the Region of code and red color. Then it also assign some value into some variable.
      May I know, what are their use and what is the purpose of doing?
      If I remove them, will affect the application?
    • gahhon
      By gahhon
      I don't find any relevant topic via Google Search. Please kindly advise how to read and update data in Google SpreadSheet.
      Thanks a lot.
    • gahhon
      By gahhon
      While Not _Login() _Initial_Check() WEnd Func _Login() Local $FLAG_LOGIN = _Password_Check() If @error = 1 Then _Close_Application() ElseIf @error = 2 Then _Metro_MsgBox(0, "", $FLAG_LOGIN) Return False Else ; $FLAG_LOGIN return TRUE _Metro_MsgBox(0, "", "Access granted!") Return True EndIf EndFunc  I do have a question regarding the While Not Loop.
      According to the code I post above, While Not _Login() is similar to While _Login() = False right?
      Which mean when _Login() return False and it will execute the _Initial_Check() function, but somehow the logic is not right and I also don't understand why While Not _Login() loop is executed as expected.
      What I wanna achieve is when _Login() is not success, which mean return False then it continue loop the _Login() function until it return True
      When It return True only execute the _Initial_Check() function.
      Please kindly clarify. Thanks
    • Jemboy
      By Jemboy
      At work we have some proprietary website, users have to login to.
      I have "made" an autoit executable to start IE, go the website, login, so the user do not have input their credentials every time.
      By NDA I am not allowed disclosed the URL of the website nor the login credentials
      So I made a fake website and an autoitscript to illustrate my question.
      #include <ie.au3> $oIE = _IECreate ("about:blank", 0, 1, 1, 1) $HWND = _IEPropertyGet($oIE, "hwnd") WinActivate ($HWND,"") WinSetState($HWND, "", @SW_MAXIMIZE) _IENavigate ($oIE, "http://demo.rkilinc.nl",1) The above start my demo website. The actual website has some links in the footer that I do not want most people click on.
      I contacted the developers of the website and they are thinking of making an option to configure what links to show in the footer, but they said it's not a high priority for them.
      I discovered, that by click F12 and deleting the <footer> element the footer is delete from the live page view (until the page is reloaded off course)
      I want to automate the removal of the footer, without using things like send().
      I tried getting the footer with _IEGetObjById and deleting it with _IEAction, but that didn't work.
      Does any one has an idea how I could delete the footer directly from view with an autoit script?
      TIA, Jem.

    • gahhon
      By gahhon
      I would like to copy the entire folder with current directory @WorkingDir
      paste into either Program Files or Program Files (x86)
      Global Const $CUR_WA_FOLDER = @WorkingDir & "\Test Folder" Global Const $DIR_FOLDER = _ProgramFilesDir() _Initial_Check() Func _Initial_Check() If FileExists($DIR_FOLDER & "\Test Folder") = 0 Then Local $Decisions = _Metro_MsgBox(4, "", "Do you want to install Test Application?") If $Decisions = "Yes" Then DirCopy($CUR_WA_FOLDER, $DIR_FOLDER, 1) Else _Close_Application() EndIf EndIf EndFunc Func _ProgramFilesDir() Local $ProgramFilesDir Switch @OSArch Case "X32" $ProgramFilesDir = "Program Files" Case "X64" $ProgramFilesDir = "Program Files (x86)" EndSwitch Return @HomeDrive & "\" & $ProgramFilesDir EndFunc