Sign in to follow this  
Followers 0
personant

cannot get html sources

15 posts in this topic

to all the pros out there..help me! I cannot get the html sources from youtube. I would like to get the sources and save it in a html file.

below are my current script

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <INet.au3>

#Region
$Form1 = GUICreate("Form1", 490, 122, 192, 124)
$YTlink = GUICtrlCreateInput("", 24, 24, 441, 21)
$Button1 = GUICtrlCreateButton("Get Source", 176, 56, 129, 41)
GUISetState(@SW_SHOW)
#EndRegion

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $Button1
            $url = GUICtrlRead($YTlink)
            getlink($url)
    EndSwitch
WEnd

Func getlink($url)
    $String = BinaryToString(InetRead($url))
    FileWrite( @DesktopDir & "\source.html", $String)
EndFunc

Once again..help me! :huh2:

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I tested your code and it works just fine. For the address you typed in, you probably was not using the FQDN sceme.

Example: typing in www.yahoo.com did not work. Typing http://www.yahoo.com did work.

Edited by sleepydvdr

#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

To compensate for people who won't know or remember, you can write a little more code that will fix that. I don't have time to test it right now, but it would go something like:

$temp = StringLeft($url, 3)

if $temp = "www" Then

$url = "http://" & $url

EndIf


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

no...even though the source file was saved on the desktop, but the file is blank..

and I still cannot get the html source :huh2:

Share this post


Link to post
Share on other sites

The posted code works fine for me too, with 'http://', that is. W/o the 'http://' prefix, the target file is created emptily..


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

does anyone have any idea how to get the html sources from youtube? :huh2:

Share this post


Link to post
Share on other sites

does anyone have any idea how to get the html sources from youtube? :huh2:

What about you post a script that can be run and doesn't work as you want?

Hardcode the input and only show the needed lines of code.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

does anyone have any idea how to get the html sources from youtube? Posted Image

Your code works for that too.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Your code works for that too.

but the output files are blank... can't figure why

Edited by personant

Share this post


Link to post
Share on other sites

ok, try this

InetGet("http://www.youtube.com", @ScriptDir & "\index.html")
:huh2:

Share this post


Link to post
Share on other sites

That code is valid & I was using AutoIt V3.3.6.1


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

is it the code or my system... :huh2:

Share this post


Link to post
Share on other sites

Definitely something with your system, check your firewall settings etc

Share this post


Link to post
Share on other sites

Is is okay now... I just have to reinstall autoit. Thank goodness :huh2:

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  
Followers 0