Jump to content

YTAPI UDF - YouTube API


Nessie
 Share

Recommended Posts

Here is another UDF! With YTAPI you can easily use the YouTube api to get all the info that you need for a specific YouTube video.

This UDF will not retrive to you the video download link!, Remember that download video from YouTube is illegal ;)

If you will find any bug, have suggestion or you want other function please just let me know!

All supported function:

;_YTApi_GetVideoID
;_YTApi_GetThumbnail
;_YTApi_GetTitle
;_YTApi_GetDescription
;_YTApi_GetAuthor
;_YTApi_GetDuration
;_YTApi_GetCategory
;_YTApi_GetStats
;_YTApi_GetRating
;_YTApi_GetRatingAverange
;_YTApi_GetUploadedDate
;_YTApi_GetUpdatedDate
;_YTApi_GetAllowedCountry
;_YTApi_IsCountryAllowed

Here is a simple Example of usage:

#include "YTAPI.au3"

$Video_ID = "dSLOR2cRouU"

$Video_Thumbnail = _YTApi_GetThumbnail($Video_ID)
If Not @error Then
    MsgBox(0, "Thumbnail", "You can see the video thumbnail at this address:" & @CRLF & $Video_Thumbnail)
EndIf

$Video_Author = _YTApi_GetAuthor($Video_ID)
If @error Then
    MsgBox(0, "Author", "The video author is: " & $Video_Author)
EndIf

$Video_Duration = _YTApi_GetDuration($Video_ID)
If Not @error Then
    MsgBox(0, "Duration", "The video duration is: " & $Video_Duration & " seconds.")
EndIf

$Video_Title = _YTApi_GetTitle($Video_ID)
If Not @error Then
    MsgBox(0, "Title", "The video title is: " & $Video_Title)
EndIf

$Video_Description = _YTApi_GetDescription($Video_ID)
If Not @error Then
    MsgBox(0, "Description", "The video is: " & $Video_Description)
EndIf

$Video_Category = _YTApi_GetCategory($Video_ID)
If Not @error Then
    MsgBox(0, "Category", "The video category is: " & $Video_Category)
EndIf

$Video_Stats = _YTApi_GetStats($Video_ID)
If Not @error Then
    MsgBox(0, "Video Stats", "Favorite Video Count: " & $Video_Stats[0] & @CRLF & "View Count: " & $Video_Stats[1])
EndIf

$Video_Rating = _YTApi_GetRating($Video_ID)
If Not @error Then
    MsgBox(0, "Video Rating", "Dislikes: " & $Video_Rating[0] & @CRLF & "Likes: " & $Video_Rating[1])
EndIf

$Video_Date = _YTApi_GetUploadedDate($Video_ID) ;Time is expressed in UTC (0)/GMT
If Not @error Then
    MsgBox(0, "Video Upload Date", "This video was uploaded on: " & $Video_Date[0] & " at " & $Video_Date[1])
EndIf

$Video_Update = _YTApi_GetUpdatedDate($Video_ID) ;Time exspressed in UTC (0)/GMT
If Not @error Then
    MsgBox(0, "Video Update Date", "This video was updated on: " & $Video_Update[0] & " at " & $Video_Update[1])
EndIf

$Video_Allowed_Country = _YTApi_GetAllowedCountry($Video_ID)
If Not @error Then
    $allowed_txt = ""
    $counter = 0
    For $i = 0 To UBound($Video_Allowed_Country) - 1
        $allowed_txt &= $Video_Allowed_Country[$i] & " , "
        $counter += 1
        If $counter = 10 Then
            $allowed_txt &= @CRLF
            $counter = 0
        EndIf
    Next

    MsgBox(0, "Allowed Country Code", $allowed_txt)
EndIf

$Video_IsCountryAllowed = _YTApi_IsCountryAllowed($Video_ID, "US")
If Not @error Then
    MsgBox(0, "Is this country code allowed?", "Country Code: 'US' is allowed!")
EndIf

Hi!

YTAPI v.1.0.0.rar

Edited by Nessie

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Link to comment
Share on other sites

Remember that download video from YouTube is illegal ;)

Can you please link to some law that states downloading a youtube Video is illegal?

Do I break the law every day? Because I watch a youtube video every day.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Can you please link to some law that states downloading a youtube Video is illegal?

Do I break the law every day? Because I watch a youtube video every day.

Downloading is ilegal, you are free to watch.
Link to comment
Share on other sites

That's two people now said this, but I wish someone would link me to even a hint of a law in any country.

I'm pretty certain that when you watch a youtube video, you download it.

I'm going to go out on a limb and suggest that in fact it is not illegal at all. Of course I'd be humbled to see proof otherwise.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

It's not a simple yes and no answer, but the crux of it is that it's not illegal, just against their terms of service.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_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: 22/04/2018

Link to comment
Share on other sites

That's two people now said this, but I wish someone would link me to even a hint of a law in any country.

The Digital Millennium Copyright Act is a United States copyright law !

The Copyright infringement is the unauthorized use of works under copyright,

such as the right to reproduce, distribute, display or perform the copyrighted work.

Terms of Service follows the law.

But in reality, millions people are downloading videos without knowing them,

it's become a habit and people think that's normal...

Who can claim to have read the terms before watching/downloading a Youtube video ?

So the purpose of the law is well understandable, but his strict application is impossible...

JohnOne, for stay on the right side of the law,

any content you download from the web, for which you do not own the copyright, must be for your personal use only. :graduated:

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

You have not the right to download a video if you don't own the copyrights except if it was released freely of course.

When you watch a video, your browser downloads it but you have not a direct access to that file, which is not the same as downloading it (and keep it somewhere to play it again) according to the law.

Edited by FireFox
Link to comment
Share on other sites

From YouTube Terms of Service:

Content is provided to you AS IS. You may access Content for your information and personal use solely as intended through the provided functionality of the Service and as permitted under these Terms of Service. You shall not download any Content unless you see a “download” or similar link displayed by YouTube on the Service for that Content. You shall not copy, reproduce, distribute, transmit, broadcast, display, sell, license, or otherwise exploit any Content for any other purposes without the prior written consent of YouTube or the respective licensors of the Content. YouTube and its licensors reserve all rights not expressly granted in and to the Service and the Content.

In fact some YouTube download app from Google Play/Store has been deleted during this year due the break of TOS.

Hi!

Edited by Nessie

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Link to comment
Share on other sites

And doesn't mean squat here in the Netherlands :)

In my country downloading copyrighted material is completely legal.

Hum...so why do they translate terms in your language ?

Extract from : http://www.youtube.com/t/terms?gl=NL

9. Content van YouTube op de Website

9.1 Met uitzondering van de door u geplaatste Content behoort alle overige Content binnen de Dienst, met inbegrip van doch niet beperkt tot tekst, software, scripts, grafische onderdelen, foto's, geluid, muziek, video's en interactieve opties op de Website, in eigendom of krachtens licentie toe aan YouTube. Alle auteursrechten, merkrechten en overige intellectuele-eigendomsrechten op Content die niet door u is geplaatst behoren toe aan YouTube dan wel aan haar licentiegevers. De in de Content van YouTube voorkomende handels- en/of dienstmerken van derden betreffen de handels- en/of dienstmerken van hun respectievelijke eigenaren. Dergelijke Content mag - zonder de voorafgaande schriftelijke instemming van YouTube dan wel, indien van toepassing, haar licentiegevers - voor welk ander doel dan ook niet worden gedownload, gekopieerd, verveelvoudigd, verspreid, verzonden, uitgezonden, vertoond, verkocht, in licentie worden gegeven of anderszins worden geëxploiteerd. YouTube behoudt zich alle rechten voor die niet uitdrukkelijk met betrekking tot hun Content zijn verleend.

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

BTW there is another point in their TOS:

You agree not to access Content through any technology or means other than the video playback pages of the Service itself, the Embeddable Player, or other explicitly authorized means YouTube may designate.

And doesn't mean squat here in the Netherlands :)

In my country downloading copyrighted material is completely legal.

Even if you are outside the DMCA if you download a video you are just against their terms of service ;)

Hi!

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Link to comment
Share on other sites

Hum...so why do they translate terms in your language ?

First of all, I was talking in general: I can download everything that can be found on the usenet without a single lawsuit.

Second of all: That's just their Terms of Service. If I do not meet them, they will ban me from the website after two formal warnings. If the copyright holders (not YouTube!) decide to sue me, it's questionable whether they'll succeed. Youtube never showed me, nor have ever asked to agree with their TOS. (given I don't have a Youtube-account)Dutch law protects end users from being sued by big companies like Universal, MGM, etc. Instead the distributer of the content (in this case: YouTube) is guilty.That's also why The Pirate Bay is blocked from the Netherlands. (Although it's kinda a hot issue now, because it's also a form of censorship :/ )

Nontheless, it's a bit of a grey area.

Edited by Kip
Link to comment
Share on other sites

With respect to the OP, I'm pretty sure this isn't where he wanted this posting to spin even if he intentionally/unintentionally provided the fuel by his assertion/warning of legality. I know it bugs me when an example posting turns into a debate. With my undue/unwarranted authority I recommend pursuance of the YouTube legal discussion be tabled to another posting in the Chat forum.

I apologize this posting is (and I am) also guilty of not providing meaningful criticism or feedback to the intended content.

Link to comment
Share on other sites

But it does break AutoIt Forum rules, no? Though based on current forum content that rule really should contain an exception for media capture, otherwise moderation in defense of another site's TOS seems arbitrary.

Automation of software/sites contrary to their EULA

Edit: Spud is probably right, and I would not have participated in the threadjacking had i seen that. I am a lover of debate though.

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

With respect to the OP, I'm pretty sure this isn't where he wanted this posting to spin even if he intentionally/unintentionally provided the fuel by his assertion/warning of legality. I know it bugs me when an example posting turns into a debate. With my undue/unwarranted authority I recommend pursuance of the YouTube legal discussion be tabled to another posting in the Chat forum.

I apologize this posting is (and I am) also guilty of not providing meaningful criticism or feedback to the intended content.

You're right !

So i have tried Nessie's example script and it works fine !

_YTApi_GetAllowedCountry and _YTApi_IsCountryAllowed function interest me.

But base your udf with reg expression, surprises me, knowing youtube for his frequent changes ! ;)

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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...