Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 16:28

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Visual Baisc] Youtube API Bot Snippets

Discussion on [Visual Baisc] Youtube API Bot Snippets within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2011
Posts: 1
Received Thanks: 0
[Visual Baisc] Youtube API Bot Snippets

Hey guys,

Here's the sources I've used for certain functions. This are only the functions, not whole copy and pastable codes. (The most of it is c&pable though).

If you don't like my coding style, not my problem. Nothing of this is objective because I'm used to C++. Due to YouTube's API not being available in C/C++ though, I made this in VB.NET, because I don't like C#.

Preparing

- First off you need the YouTube GData Libraries:
Download and install the YouTube API Libraries:
- Then obtain an API key here using a Google Account:
- Start a new VB.NET Project and link to Google.GData.Client.dll, Google.GData.Extensions.dll, Google.GData.YouTube.dll
You can find them here:

Code:
C:\Program Files (x86)\Google\Google YouTube SDK for .NET\Samples
(or where ever you installed the SDK. Note: Though youtube says you can find them in the "Redist" Folder, this particular folder doesn't contain all necessary Libraries.)
- You will need the following imports:
Code:
Imports Google.GData.Client
Imports Google.GData.Extensions
Imports Google.GData.YouTube
Imports Google.GData.YouTube.YouTubeService
Imports Google.GData.Extensions.MediaRss
Imports Google.YouTube
Imports System.Management
Imports System.Net
Imports System.IO
- Now you're ready to do some coding!

Snippets

First you need to authenticate yourself with the API key and an account:

Code:
Dim settings As YouTubeRequestSettings
Dim request As YouTubeRequest
settings = New YouTubeRequestSettings(APPLICATION_NAME, DEVELOPER_KEY, ACC_USERNAME, ACC_PASSWORD)
request = New YouTubeRequest(settings)
APPLICATION_NAME: The app name you've chosen in google developer dashboard
DEVELOPER_KEY: Your api/dev key for the particular app you defined before
ACC_USERNAME + ACC_PASSWORD: Obvious

--

Then, you need to define a Video:

Code:
Dim VideoFeedUri As Uri
Dim dVideo As Video
VideoFeedUri = New Uri("http://gdata.youtube.com/feeds/api/videos/" + dVideoID)
dVideo = request.Retrieve(Of Video)(VideoFeedUri)
dVideoID = Your video ID (the thing behind watch?v= WITHOUT special addons like &feature=related

--

Now, once you're authenticated and you've defined a video you can do some cool stuff:

Like Video

Code:
dVideo.Rating = 5
request.Insert(dVideo.RatingsUri, dVideo)
Dislike Video

Code:
dVideo.Rating = 1
request.Insert(dVideo.RatingsUri, dVideo)
Subscribe to uploader of video

Code:
Dim s As Subscription = New Subscription
s.Type = SubscriptionEntry.SubscriptionType.channel
s.UserName = dVideo.Uploader
request.Insert(New Uri(YouTubeQuery.CreateSubscriptionUri("SUBSCRIBER_ACC")), s)
SUBSCRIBER_ACC: The account which subscribes to the channel. Has to be the account you authenticated with.
Note: You can basically subscribe to any channel by just adjusting s.UserName.

Add a video as favorite

Code:
Dim videoEntryUrl As String = "http://gdata.youtube.com/feeds/api/videos/" + dVideoID
Dim service As YouTubeService = request.Service
Dim videoEntry As YouTubeEntry = service.Get(videoEntryUrl)
Dim feedUrl As String = "http://gdata.youtube.com/feeds/api/users/default/favorites"
service.Insert(New Uri(feedUrl), videoEntry)
Adding a comment

Code:
Dim c As Comment = New Comment()
c.Content = "Comment Content"
request.AddComment(dVideo, c)
Flagging a video

Code:
Dim c As Complaint = New Complaint
c.Type = ComplaintEntry.ComplaintType.DANGEROUS
c.Content = "This video is dangerous!! My son watched it, this should be deleted"
request.Insert(dVideo.ComplaintUri, c)
Note: Other Flag types are: ComplaintEntry.ComplaintType.HATE, ComplaintEntry.ComplaintType.PORN, ComplaintEntry.ComplaintType.RIGHTS, ComplaintEntry.ComplaintType.SPAM, ComplaintEntry.ComplaintType.VIOLENCE

Sending message (video recommendation -> no send limit per account)


Code:
Dim friedsInbox As String = "http://gdata.youtube.com/feeds/api/users/" + id + "/inbox"
Dim newMessage As MessageEntry = New MessageEntry
Dim videoEntry As YouTubeEntry = request.Service.Get("http://gdata.youtube.com/feeds/api/videos/" + dVideoID)

newMessage.Title.Text = "Message Subject / Title"
newMessage.Summary.Text = "Message Text"
newMessage.Id = videoEntry.Id

request.Service.Insert(New Uri(friedsInbox), newMessage)
id = account to receive message

Adding contacts

Code:
Dim feedUrl As String = "http://gdata.youtube.com/feeds/api/users/default/contacts"
Dim newFriend As FriendsEntry = New FriendsEntry
newFriend.UserName = "FriendToAdd"
newFriend.Categories.Add(New AtomCategory("Friend Category", YouTubeNameTable.FriendsCategorySchema))
request.Service.Insert(New Uri(feedUrl), newFriend)
Now have fun !
Dispicable is offline  
Old 11/11/2011, 19:20   #2
 
elite*gold: 718
Join Date: Oct 2011
Posts: 625
Received Thanks: 64
vllt mal Credits geben, von wem du es c&p hast -.- die snippets sind von maxn ( mate von mir )
l1ght # is offline  
Old 11/11/2011, 19:51   #3
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
Quote:
Originally Posted by l1ght # View Post
die snippets sind von maxn ( mate von mir )
Kannst du das auch beweisen?^^
Es gibt sicher nicht nur ein Programm, welches die YouTube API benutzt, und die Funktionen sind bestimmt nicht bei jedem komplett anders, wie denn auch?
Kraizy​ is offline  
Thanks
1 User
Old 11/13/2011, 19:33   #4
 
Yakiyo's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 1,898
Received Thanks: 303
Quote:
Originally Posted by xKraizy View Post
Kannst du das auch beweisen?^^
Es gibt sicher nicht nur ein Programm, welches die YouTube API benutzt, und die Funktionen sind bestimmt nicht bei jedem komplett anders, wie denn auch?
Ja, es ist von diesem Hampelmann.
Ich habe diese Snippets ja selbst gepostet, hab es halt sozusagen übersetzt.
Yakiyo is offline  
Old 11/13/2011, 20:22   #5
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
Ich versteh nicht ganz, warum es hier um Maxn geht. Vielleicht habt ihr beiden ja diese Funktionen von ihm, d.h. doch aber nicht, dass er sie "erfunden" hat, denn so ist halt der Aufbau, wenn man z.B. ein Video liken will..
Hier gibts den Aufbau von allen Funktionen: welche man dann eben auf VB.NET übertragen muss, was nicht gerade schwer ist..und am Ende hat jedes Programm den selben Code..
Kraizy​ is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
Visual Baisc 2008 / Login
10/24/2011 - Coding Releases - 2 Replies
In Zeiten in denen mir langweilig ist beschäftige ich mich gerne ab und zu mit Visual Baisc 2008 (2010 / Exisitert kein wirklicher unterschied) Und habe mir gedacht ich bastel mir ein (Login/Register) Script. Das Script habe ich mir gebaut um einen Chatroom zu Erstellen (Der Chatroom) ist auch Tool dabei , funktioniert allerdings noch nicht da es ein Multi TCP Server ist. (Localhost eingestellt) :D Den Server möchte ich nur ungerne dazu geben. So also folgendes kann mein Tool : 1....
Visual Baisc Frage
02/02/2011 - Main - 4 Replies
Hallo und zwar habe ich das Problem dass, ich habe ein Programm programmiert das etwas downloadet und während dem download henkt sich das Programm auf wenn der download aber fertig ist dann kann ich das Programm wider benutzen gibt es da irgend einen Code dass sich das Programm nicht aufhenkt ??? Freue mich auf Antworten Gebe THX
Visual Baisc 2008 Hilfe bitte
12/17/2010 - .NET Languages - 1 Replies
Hey Leute , Ich beschäftige mich jetzt seit einigen Monaten mit Visual Basic , allerdings fange ich erst jetzt an mit Online Datenbanken zu arbeiten. Deswegen habe ich mir Überlegt einen Download Manager (Sucher) zu Erstellen , der den Download Link angibt. Leider weiß ich nicht ganz wie ich das anstellen soll und hoffe mir kann jemand helfen. Genau Beschrieben: Also ich möchte in meinem Programm halt am Anfang eine Suchmaschine in die man ein beliebiges Wort eingeben kann. Nun...
[Tutorial] Virus mit Visual Baisc 2008 erstellen!
06/07/2010 - Coding Tutorials - 8 Replies
/edit by Walter Sobchak



All times are GMT +1. The time now is 16:28.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.