In order to unsubscribe your request needs to know the unique
subscription id associated with the subscription. Knowing the channel
name isn't enough. (This is documented at the protocol level at
http://code.google.com/apis/youtube/2.0/developers_guide_protocol_subscriptions.html#Deleting_a_subscription)
So you could take that code that retrieves all subscriptions (the
entries will have the proper subscription id pre-populated in that
case) and in the for loop that iterates through the subscriptions, you
could check each one to see if the subscription.UserName property
matches the name of the channel you want to unsubscribe to. If it
does, you could call subscription.SubscriptionEntry.Delete() and break
out of the loop. If it doesn't match, just go on to the next entry in
the loop.
Cheers,
-Jeff Posnick, YouTube API Team
groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
@YouTubeDev
On Jan 8, 8:10 am, Irata <darkir...@googlemail.com> wrote:
> Hello,
> sry for my bad english.
>
> Im working on a programm based on vb.NET.
> Uploading, get information and all this stuff works... but unsubscribe
> not.
> i always get a nullreferenceexception error. Same is in C#
>
> This is my VB Source for unsubscribe
>
> Dim s As Subscription = New Subscription
> s.Type = SubscriptionEntry.SubscriptionType.channel
> s.UserName = "THE-USER-I-WANNA-UNSUBSCRIBE"
> request.delete(s)
>
> Where is the problem?
>
> I use the search and found this code (a little bit other)
>
> Dim subscriptions As Feed(Of Subscription) =
> request.GetSubscriptionsFeed("MY-AUTH-USERNAME")
> Dim subscription As Subscription
> Dim i As Integer
>
> For Each subscription In subscriptions.Entries
> i = i + 1
> TextBox4.AppendText(i & ": " & subscription.UserName)
> subscription.SubscriptionEntry.Delete()
> Next
>
> But here it unsubscribe all subscribtion. How could i delete/
> unsubscribe a fixed user.
>
> mfg.
--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.
No comments:
Post a Comment