Jump to content
Sign in to follow this  
TheOnlyOne

_ie function to choose Referrer

Recommended Posts

TheOnlyOne

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
TheOnlyOne

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
TheOnlyOne

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

 

Share this post


Link to post
Share on other sites
TheOnlyOne

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

    • SC0U7
      By SC0U7
      Hello i have a text file which contain over 600KB of BASE64 strings like :
      TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
      Now what i need is divide this long string as autoit variable each max lenght (4000characters per line) example:
      Local $var
      $var &=  TVqQAAMAAAAEAAA..
      $var &=  VbAmejwqqqAACEE..
      and then how to i add encrypt function on every line ? how to i can xor it? example final will be :
      $var &=  XorEnc(TVqQAAMAAAAEAAA..)
      $var &=  XorEncVbAmejwqqqAACEE..)
       
      Thanks for any help and ideas 
    • JuanFelipe
      By JuanFelipe
      Hello friends, I would like to know how to open a GUI from another GUI, I did it the way I leave the attached code, but when closing the second GUI they all close, they could help me to solve this problem without compiling another script. Thank you #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 173, 126, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 16, 24, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _form2() EndSwitch WEnd ;================================================= GUI 2 Func _form2() $Form1 = GUICreate("Form2", 615, 437, 192, 124) GUISetState(@SW_SHOW) While 2 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc  
    • FMS
      By FMS
      Hello,
      I try to get all the text from a news site around a subject.
      The first run I get all the text inside a attribute in an array.
      When i try to go back and reload another page it chrashes and think it because "$oIE.GoBack"
      I couldn't find anything in the help/forum around this subject.
      Do I need to reload the $oIE or something afther an X.GoBack?
      The error i got is :
      if $oTag2.GetAttribute("class") == "NewsDetail" Then if $oTag2^ ERROR I'm not shure why I got this error, maybe someone could explain?
      Also I'm open for some pointers in this test script because I'm pretty new in working whit the IE.UDF
      Maybe there is an simpler way to get the same results?

      test script:
      #include <IE.au3> #include <MsgBoxConstants.au3> #include <Array.au3> HotKeySet("{ESC}", "Terminate") Global $oIE = _IECreate("https://www.iex.nl/Zoeken/Nieuws.aspx?q=air%20france") ;get first subject Global $oLink1 = _IEGetObjById($oIE, "ctl00_ctl00_Content_LeftContent_NewsSearch_repNews_ctl00_linkNews") Sleep(500) _IEAction($oLink1, "click") Sleep(500) Global $oTags = _IETagNameGetCollection($oIE, "div") Global $aResults[1] For $oTag In $oTags if $oTag.GetAttribute("class") == "NewsDetail" Then _ArrayAdd($aResults, $oTag.innerTEXT) EndIf Next $aResults[0] = UBound($aResults) - 1 _ArrayDisplay($aResults, "Episodelist") ConsoleWrite($aResults[1] & @CRLF) $oIE.GoBack ;get second subject Global $oLink2 = _IEGetObjById($oIE, "ctl00_ctl00_Content_LeftContent_NewsSearch_repNews_ctl01_linkNews") Sleep(500) _IEAction($oLink2, "click") Sleep(500) Local $oTags2 = _IETagNameGetCollection($oIE, "div") Local $aResults2[1] For $oTag2 In $oTags2 if $oTag2.GetAttribute("class") == "NewsDetail" Then _ArrayAdd($aResults2, $oTag2.innerTEXT) EndIf Next $aResults2[0] = UBound($aResults2) - 1 ConsoleWrite($aResults2[1] & @CRLF) Func Terminate() _IEQuit($oIE) Exit EndFunc ;==>Terminate  
    • bowker
      By bowker
      Hi! Is there a way for me to set the value for my slider? I am getting the value for my slider with
       
      Local $strText = _UIA_getPropertyValue($oUIElement, $UIA_LegacyIAccessibleValuePropertyId) MsgBox(0,"",$strText)  
    • nacerbaaziz
      By nacerbaaziz
      Hello
      Can we pause and resume the download in the InetGet function?
      If is possible, what is the solution please?
      I used this code To manage the download

      #include <INet.au3> func _downloader($name, $linc, $filepath, $RTLF = false, $link = false) global $downloader = GUICreate("downloader", 400, 200, -1, -1, $WS_CLIPCHILDREn, $RTLF, $link) global $path = $filePath $labelTxt = GUICtrlCreateLabel("downloading " & $name, 50, 10, 200, 20) global $labelTxt0 = GUICtrlCreateLabel("downloaded size 0 MB " & "OF 0 MB", 50, 60, 300, 20) global $Progress = "" global $sText = ""     For $i = 1 To Random(5, 20, 1) ; Return an integer between 5 and 20 to determine the length of the string.         $sText &= Chr(Random(65, 122, 1)) ; Return an integer between 65 and 122 which represent the ASCII characters between a (lower-case) to Z (upper-case). next global $labelTxt2 = GUICtrlCreateInput("0%", 50, 80, 50, 20) _GUICtrlEdit_SetReadOnly(-1, true) GUIStartGroup("") global $beep = GUICtrlCreateCheckBox("use the progress beep notification", 150, 120, 200, 20) GUIStartGroup("") $button = GUICtrlCreateButton("Cancel', 130, 150, 180, 25, 0x01) $iIndex = 0 global $Target global $url GUIStartGroup("") global $Progress = GUICtrlCreateProgress(50, 90, 150, 20) global $Target = $filepath global $url = $linc global $path = $filepath global $hDownloadNo = _RSMWare_GetData($url, $Target) global $status = false AdlibRegister("SetProgress") global $onprogress = false, $curent = false GUISetState(@sw_Show) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $button $asc = MsgBox(4132,"exit download?","if you click yes the downloading will be cancel, do you want to cancel it ?") if $asc = 6 then AdlibUnRegister("SetProgress") GUIDelete() If $hDownloadNo <> 0 Then InetClose($hDownloadNo) exitLoop endIf EndSwitch if $status = -1 then $status = 0 $hDownloadNo = _RSMWare_GetData($url, $Target) $onprogress = false $curent = false elseIf $Status = 1 then $status = $path GUIDelete() AdlibUnRegister("SetProgress") exitLoop endIf WEnd return $status endFunc Func _RSMWare_GetData($url, $Target) Local $hDownload = InetGet($url, $Target, 1, 1) Return $hDownload EndFunc ;==>_RSMWare_GetData Func SetProgress() Local $state If $hDownloadNo <> 0 Then $state = InetGetInfo($hDownloadNo) If @error = 0 Then $infor = "downloaded size " & Round(Execute(InetGetInfo($hDownloadNo, $INET_DOWNLOADREAD) / 1048576), 2) & " MB of " & Round(Execute(InetGetInfo($hDownloadNo, $INET_DOWNLOADSIZE) / 1048576), 2) & " MB " $onprogress = Round(Ceiling(($state[0] / $state[1]) * 100)) if not (InetGetInfo($hDownloadNo, $INET_DOWNLOADSIZE) = 0) then if $onProgress <= 0 then $onProgress = 0 GUICtrlSetData($Progress, $onProgress) GUICtrlSetData($labelTxt0, $infor) GUICtrlSetData($labelTxt2, $onProgress & "%") if _isChecked($beep) then if $onprogress > $curent then beep((100 + $onprogress * 20), 100) $curent = $onprogress endIf endIf endIf If $state[2] Then If $state[3] Then InetClose($hDownloadNo) $status = 1 else InetClose($hDownloadNo) $status = -1 endIf endIf EndIf endIf EndFunc ;==>SetProgress
×