Keyword entries for videos coming back blank, subsequently deleted - c#

UPDATE: apparently this only happens when fetching videos from a playlist feed, which is what I'm doing.
I recently noticed my youtube api requests for videos were returning blank keyword entries. I found the blog post at http://apiblog.youtube.com/2012/08/video-tags-just-for-uploaders.html, and I'm already sending requests as the channel/video owner, yet I still get blank keywords. This has the undesirable side-effect of deleting existing keywords if I make any changes to the video details, such as to descriptions or titles.
For instance, I have video series where every video will have the same description. Perfect place to use the API to run through all the vids in a list and update their details. This used to work fine. But one ill-fated day, this routine became destructive. Any time I do this now, the keywords get blanked out, and I have to go back through all of the affected vids, replacing the lost keywords by hand. I've stopped using my API-based utility since this began happening.
The descriptions and titles will get updated as desired, but the keywords get blanked out, even if I don't touch them. I recall reading somewhere in the API docs something to the effect that when you submit updates for video details, any entries not filled in will be erased. In this instance, because the keyword entries I get back are already blank, any updates I do to the video other than to the keywords cause the keywords to be deleted.
Anybody have any ideas or workarounds? If I can't continue using the API to manage keywords, I would at least like to be able to continue making updates to titles and descriptions, but that won't work right now because the keywords get deleted with any title or description updates :(

The YouTube API should absolutely return media:keywords when you make an authenticated request for a video or a feed of videos in the current account. You can test it yourself at
http://gdata.youtube.com/demo/index.html
Click Authenticate there, then make a request for Uploads -> Query, and enter default as the user name. Run that request and take a look at the responses—all the videos that actually have keywords should have a media:keywords returned for them. (Obviously if you've already deleted the keywords for a given video, they won't be returned, so test with a newly uploaded video that you've set keywords for.)
There is an internal bug that I believe is still open that prevented media:keywords from being returned in playlist entries when you're fetching a playlist feed. Are you perhaps reading your videos from a playlist?

Actually, this is a known issue as YouTube decided to allow Keywords retrieval only for authenticated users.
This is very annoying, but I'm also currently looking for a way safe way to retrieve those keywords, using Zend, without writing donw my password in plain text.
Let's look for a solution together :)
YOUTUBE API : Retrieve video keywords

Related

Is there a way to capture a view and save it?

We have many element(s) in a ContentPage. The goal is to take a picture of a specific element and then have access to that data - to save it or possibly other things such as cropping it.
So this question is twofold - is there a way to photographically capture a given element? Is there a way to do this if the element is not fully in view? Example a ScrollView would potentially have some of its elements not currently in view.
Our attempt at this is to use device specific screenshots and crop them to a given element. The screenshots are working, but we aren't having luck with cropping. Not to mention in the case as described above the screenshot will not work as the view isn't fully visible.
Is there a way to obtain the "graphical" (photo) data of an element at a given time even if it's not currently visible/partially visible?
Thanks for reading in advance.
After a lot of talking, this is what I understand
The Users of your application are the Workers of Your company
The application is for managing the accounts of your companies Customers
The Customers have no access to their data, in any shape or form
Part of the Customer Data is their Email Adress
You want to send a copy of their Data to the Customers
As Emails do not allow formating that well, you want to send that Data as a Screenshot of the UI.
If I got all that right:
You are neck-deep in a XY Problem. Or rather a ((XY)Y)Y Problem - a XY problem of the 3rd Generation.
The obvious solution would be to fix point 3 and give your customers access to their Data already:
You can do that via a extra Programm, App, a Webpage or anything similar. If they can receive emails, they can download a app or open a Webpage and see their data there. May need a login, but nothing special. There are even ways to encode data/direct links into Emails and register your Programm with a custom Format. Indeed, that is how Steam Links on the Desktop work.
Meanwhile the In-House user get a "Customer Management" Programm that allows more direct access to the Customers Data in the Database (I asume you got a backend Database. But it is at least possible you do not).
If you can not fix Option 3 for stupid Boss/Legal Reasons (these are the only Valid reasons I can Imagine. And I can not stress enoug how stupid the boss would have to be in that), you should at least be able to fix at Point 5/6:
The first Option would be to send Text Emails. People often underestimate jsut how much is possible with pure Text. It is basically like writing on a Console, but even that is enough medium to make a Art in it.
The other ways involve Managing the HTML limitations:
Save HTML Mail
The main security issue with HTML mails, is "downloading external content" part. Those operations can not be reliable scanned by Virus scanners and the like - especially in the age of HTTPS. Unless we talk about Kaspersky and the stupid Idea they had.
And even if they can be scanned reliable, even just the request of those files can be used for spam senders to verify the Email Adress is still in use. So it is a no-go too.
So you will need to Inline as much as possible. Inlining images is not that possible. While HTML totally has a Standart for that - you Base64 encode the binary into the HTML - this does not work reliably. At least Microsoft Outlook is known to interpret all Base64 images in the Email as Attachments - even the inlined ones. And even if they fixed this or it is no longer a relevant issue, inlining images tends to increase the HTML size significantly.
You can use CSS to some degree. But aside from inlining it, you might have to go back a step or two. In the end, Email Programms are really weak web-browsers. So they do not nessesarily support all the latest stuff instantly. Anything below CSS 3.0 should reliably work by now. But you better ask someone once you got more specific Requirements for this Email.
PDF Attachment
Somewhat more established is to create a .PDF file and send it. All those bills/other stuff in .PDF format you get - those have been created on demand from a Database, by the same code that also send the Email. In many cases the demand was automated too or the Sending Programm was a outright Background Process.
.PDF allows all Formating you could want. It can take up images inline. And there is plenty of ways to create .PDF from code. And as you can send it as a attachment, the Virus scanner has time to go over it. And we are not in the last Millenium, where a PDF Reader was a uncommon programm to have installed (I still remember the times when a current Version of Acrobat PDf Reader was delivered on every CD with a .PDF Format Handbook).
If you are stil dead serious about the whole "make a Image of the UI to send that", my only question is: How many Years have been aloted for that?

Youtube API comments order is incorrect/ Webpage doesn't load youtube Correctly

So there are two issues as I tried to solve a problem. Solving either of them will be fine for me
Issue 1:
I have been trying to get a program to show me the "order" of a certain comment. However I ran into an issue while implementing the API.
First of all I got the HTTP request from here: https://developers.google.com/youtube/v3/docs/comments/list
My HTTP was:
https://www.googleapis.com/youtube/v3/commentThreads?key=XXXXXXXXXXXXXXXXX&textFormat=plainText&part=id&videoId=26P7y8gEkiQ&maxResults=100&order=relavence
Now this will get me a list which has comments and their IDs. All fine except for one problem.
The order that appears in that page is not the same one you see on Youtube! Which is confusing since the relavence should cover that. But for some reason... it doesn't!
Any Clue what is going wrong here?
Edit: I have been trying to get the order of comments using C#/Vb.net. Problem was that getting the page directly (Youtube) didn't load the comments. now i used YT API but its not doing what it should have.
2nd Issue: I tried to load youtube Webpage using both HTTPRequest and a Webbrowser. Both do not load the comments for some reason. I used this approach to try and scrape the comments directly from the HTML document. The comments seem to be "loading" indefinitely.
Usually, comments in YouTube is sorted by "Top comments" or "Newest first". By using the API, you can get only comments ordered by time (Comment threads are ordered by time. This is the default behavior.) or relevance (Comment threads are ordered by relevance.). Here's a related thread which might help: Get comments thread for a YouTube video using api v3.0

Google Checkout and charge-amount-notification

I've got all the initial code working that handles the purchase for the user through Google Wallet and submits the actual charge to their credit card. Also in the setup I specified a post-back url for this where I capture the order details like the order number, price, item name, etc and I save them to my database.
But when I look in Google Wallet under 'orders' I see the order flagged in yellow with the description 'chargeable' (after awhile it will turn to green and be marked 'charged') so clearly there needs to be some checking to make sure the charge was made successfully before I treat it as such. The Google documentation says that I need to receive a charge-amount-notification back from them to confirm that the charge was successful. But I see no good examples for this or instructions on how to implement it. Do I need to poll their API for a success code or something? I really just need a good example in C# so I can see how this all ties together and how best to proceed.
thanks!

Not sure how to store some data

I'm making a website that lets you share your music tastes, it works with a desktop client that monitors your media player (iTunes, whatever), and sends the details of the song that is currently playing to the site, where it is associated with your profile.
This output is displayed on your profile, and the idea is the page mirrors your local music player, right down the the position of a progress bar.
However I can't decide how to store the data. As soon as the song is over, it becomes useless, so something permanent like a MySQL database seems pointless.
Session variables don't work, because the script that does the work is not directing you to the page that displays the output. The idea is that the backend script just gets the info as it arrives and saves it somewhere, and you can get the latest info whenever you load the profile page.
I'm currently using a textfile, as a bad and temporary solution, just writing a new line each time and then reading it.
What is there between session variables and SQL?
And how can I get the output page to update every time there is new data? I need a way of storing it that allows events to be triggered, so checking it mustn't be too intensive.
I think a (My)SQL database would be alright, especially if you want to show the last few songs somebody played.
But if you just need a temporary data store to hold a single song per user, you could use a key-value store like memcached. It stores data directly in memory instead of a file or database. The key would be something unique (like the user's name or id) and the value would be data about the currently playing song.
You should look into memcached with a low cache expiry on keys of this type.
I would definitely store this in a database with a timestamp. For your display query, all you have to do is select the most recent (unless it has been more than a certain amount of time, in case the player is disconnected).
It might be best to hang on to this data. You may want it later to show which songs they play most or something. Otherwise, you can always delete the old records. I suspect keeping them will be worthwhile later. (Also consider the privacy implications of this. Make sure you tell your users the kind of data you keep in your privacy policy.)
Well I think you could use SQL, just have a table that stores the UserId, "current/last" song field, "currentlyPlaying" (bool), and you keep writting on top of that field everytime there is a new song, so that way you only have one row for each user all the time. It is still permanent, but you only keep track of the last song.
As a sidenote, you might want to save in a more permanently way all the songs a user plays.. if it is supposed to be a music tastes sharing site, having a history of played songs would let you make some nice algorithms like recommendations, etc.

How to get rss old items like google reader

I'm creating RSS reader application. I need to get any linked rss old items. For example some web rss result count is too less. My application check time range is too long. Sometimes loss some news.
How can I get rss old items?
When scrolling down on the google reader,reader shown previous items.
try this http://www.google.com/reader/atom/feed/{complete url to rssfeed without {} }?n=5000
I guess, Google saves these items and can display them, even if they are no longer in the feed. Google Reader might even show you items from before you added the feed, because the feeds might be stored globally and not per user.
Yes, the strategy recommended by #someone can help on this. Expanding on that:
Google Reader unofficial API lets you ask for old items from feeds, but it'll be very slow (if you're asking for 10000 items for instance), so you should ask for that once and cache it on your side.
If you need more than 10000~20000 you'll probably get timeouts on the Google server side. To help with this you can probably ask for 1000 or something items each time (http://www.google.com/reader/atom/feed/), and then use the continuation parameter for paging. I've never used this one, but it contains a parameter (c, for continuation) that can be promising for what you need. As described here (in the 'Atom set of items' section):
a string used for continuation process. Each feed return not all items, but only a certain number of items. You'll find in the atom feed (under the name gr:continuation) a string called continuation. Just add that string as argument for this parameter, and you'll retrieve next items.
One more thing, you'll need to login to Google Reader before using that API. If you want code for that, check my answer to this other question.
Hope it helps!
Since Google Reader shut down about a year ago, I'd suggest you give a shot at Superfeedr if you're looking for a replacement.

Categories

Resources