-
Notifications
You must be signed in to change notification settings - Fork 1
Home
loudKode edited this page Dec 11, 2019
·
31 revisions
Download:
https://github.com/loudKode/DailymotionSDK/releases
NuGet:
Features
- Assemblies for .NET 4.5.2 and .NET Standard 2.0 and .NET Core 2.1
- Just one external reference (Newtonsoft.Json)
- Easy installation using NuGet
- Upload/Download tracking support
- Proxy Support
- Upload/Download cancellation support
- CheckAccessToken
- RemoteUpload
- UserInfo
- ListFeaturesVideos
- ListVideos
- DeleteVideo
- VideoMetadata
- EditVideo
- APIrateLimits
- UploadLocalFile
- RevokeAccessToken
- GetVideoDirectLink
- EditVideoPrivacy
- AddTag
- AddToFavorites
Async Sub GetTokenByProvidingUserAndPass()
Dim tkn = Await DailymotionSDK.GetToken.By_UsernameAndPassword("api key", "api secret", "user", "pass")
DataGridView1.Rows.Add(tkn.access_token, tkn.refresh_token, tkn.expires_in, tkn.uid)
End Sub
Sub GetTokenByBrowser()
Dim ScopeItems As New List(Of DailymotionSDK.GetToken.ScopesEnum) From {DailymotionSDK.GetToken.ScopesEnum.manage_videos, DailymotionSDK.GetToken.ScopesEnum.email}
Dim tkn = DailymotionSDK.GetToken.By_AddressBar("client id", ScopeItems)
Process.Start(tkn)
End Sub
Dim MyClient As DailymotionSDK.IClient = New DailymotionSDK.DClient("access token")
Sub SetClient()
Dim MyClient As DailymotionSDK.IClient = New DailymotionSDK.DClient("access token")
End Sub
Sub SetClientWithOptions()
Dim Optians As New DailymotionSDK.ConnectionSettings With {.CloseConnection = True, .TimeOut = TimeSpan.FromMinutes(30), .Proxy = New DailymotionSDK.ProxyConfig With {.ProxyIP = "172.0.0.0", .ProxyPort = 80, .ProxyUsername = "myproxyName", .ProxyPassword = "myproxyPass", .SetProxy = True}}
Dim MyClient As DailymotionSDK.IClient = New DailymotionSDK.DClient("access token", Optians)
End Sub
Async Sub ListMyVideos_limitedto14video()
Dim result = Await MyClient.Mine.ListVideos(VideoSortEnum.recent, 14, 1)
For Each vid In result.VideoList
DataGridView1.Rows.Add(vid.name, vid.tiny_url, vid.preview_480p_url, vid.thumbnail_240_url)
Next
End Sub
Async Sub ListMyVideos()
Dim result = Await MyClient.Mine.ListVideosRecursively(VideoSortEnum.recent)
For Each vid In result.VideoList
DataGridView1.Rows.Add(vid.name, vid.tiny_url, vid.preview_480p_url, vid.thumbnail_240_url)
Next
End Sub
Async Sub AddVideoTags()
Dim result = Await MyClient.Mine.AddTag("video id", New List(Of String) From {"tag1", "tag2"})
End Sub
Async Sub AddVideoToFeaturesList()
Dim result = Await MyClient.Mine.Features.Add("video id")
End Sub
Async Sub GetCurrentApiLimitsRate()
Dim result = Await MyClient.Mine.Account.APIrateLimits()
DataGridView1.Rows.Add(result.UserID, result.limits.video_size, result.limits.video_duration)
End Sub
Async Sub DeleteAVideo()
Dim result = Await MyClient.Mine.DeleteVideo("video id")
End Sub
Async Sub EditVideoInfo()
Dim result = Await MyClient.Mine.Edit("video id", "new title", New List(Of String) From {"tag1", "tag2"}, ChannelsEnum.animals, PrivacyEnum.Public)
End Sub
Async Sub VideoDirectUrl()
Dim result = Await MyClient.General.GetDirectLink("video id")
DataGridView1.Rows.Add(result.VideoResolutionUrls.R_720, result.VideoResolutionUrls.R_480, result.VideoResolutionUrls.R_380)
End Sub
Async Sub Upload_Remote()
Dim result = Await MyClient.Mine.UploadRemote("https://www.tube.com/video.mp4", "my title", Nothing, Nothing, PrivacyEnum.Private)
End Sub
Async Sub Upload_Local_WithProgressTracking()
Dim UploadCancellationToken As New Threading.CancellationTokenSource()
Dim _ReportCls As New Progress(Of DailymotionSDK.ReportStatus)(Sub(ReportClass As DailymotionSDK.ReportStatus)
Label1.Text = String.Format("{0}/{1}", (ReportClass.BytesTransferred), (ReportClass.TotalBytes))
ProgressBar1.Value = CInt(ReportClass.ProgressPercentage)
Label2.Text = CStr(ReportClass.TextStatus)
End Sub)
Dim RSLT = Await Clnt.Mine.UploadLocal("J:\DB\myvideo.mp4", UploadTypes.FilePath, "myvideo.mp4", Nothing, Nothing, PrivacyEnum.Public, _ReportCls, UploadCancellationToken.Token)
End Sub