Jump to content

_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
Link to comment
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()
GUICtrlCreateObj($ie,0,0,200,200)
GUISetState(@SW_SHOW)
_IENavigate($ie,"google.com",1)
sleep(200)
_IEDocWriteHTML($ie,$buildHtml)
_IEAction($ie, "refresh")

while(1)
sleep(5)
WEnd

 

Link to comment
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
 Share

×
×
  • Create New...