Need the details of youtube video in .Net - c#

I need to extract the details of a given youtube link, which might include:
1. Youtube Video,
2. Size of video,
3. Duration,
4. Thumbnail image,
5. Image - Height/width,
6. Size of thumbnail image,
7. Title of youtube video.
I have tried using youtube-api, but could not see if I can give the video URL and access the required details.
And other relevant details of the video. and then Need to display the video on my web page.
Which APIs are the best to use in this case.?
Thanks

All you need you can get from youtube-api. You just need to build right request with videoID from your link and parse json response, where is all data you want. Sample of such request:
GET https://www.googleapis.com/youtube/v3/videos?part=snippet&id=k4YRWT_Aldo&key={YOUR_API_KEY}

Related

How to extract the embedded/preview image from a link in C#?

Im building a C# program that shows the news feed from a RSS XML page and I want to include a feature that shows a link, the title (Which I already have) and the image preview of that link like it happens on Discord, or Messenger.
If we send a link of a post, for example, and that post has a image, it will show a preview (+/- like the pictures). Same happens for Youtube links, it shows the tumbnail of the video.
Here is an example of a link from a post on Discord and Messenger.
It displays the "main picture" of that post.
Discord example: http://prntscr.com/n8j0m6
Messenger example: http://prntscr.com/n8j29f
I want to extract the embedded/preview image from a link in C# or at least the link of that image (So I can then load it in the program) or create a similar preview system. That would be even better. But with the image link, I can create a method to do that automatically.
I havent had any luck finding anything similar so far. Maybe I am not using the correct term.
Thank You in advance.

Search Image in google

I need to search in google images for a photo and to take the first result and to put in picturebox.
The search is by a string that the user is picking.
please help.
I am Using c#
To hit the Google Image API from your c# code, you will need to perform an HTTP post request. I believe this post can show you how to format your request.
Also, it appears that the Google Image API is deprecated and will no longer work soon, according to this post.

how to get count of videos in a web page using code(by parsing it)

Does any one know how to check if the webpage has any videos or video links.
Like for example:
I am doing web automation for LG. Then i need all the video links(or Counts of video in a particular page).
This LG product link for product:GR-D907SL contains 12 Images, 1 Video and 0 Flash.
I am getting count for Images and flash. but how to get for videos?
Is there any way i can find there is a video?
I didnt find an answer for this so i did it using regular expresions
i identified using the
keywords like EMBEDDED, PLAYER
if there is any answer please let me know

How to download a video file from YouTube to hard disk using C#.NET?

How to download a video file from YouTube as .FLV or .MP4 format to hard disk using .NET?
I want to create a small YouTube downloader application which asks the user for the specefic link, when i click the download button, the download process start downloading the video as an FLV file directly from YouTube server to the hard disk.
I'm not asking here for the detailed procedure but i want to know only how to start ? is there a YouTube c# api which handle this process.
How to download an Flv video file from YouTube to hard disk using C# ?
Thank you !
I think this project is interesting
https://github.com/flagbug/YoutubeExtractor
try run an embed browser and add event handler to grep URLs of all resources on webpage, then you can study the protocol used by youtube.
changing the HTML request header to simulate an iOS device may force youtube use HTML5 player , instead of flash player ( if the above method cannot track network activities inside a flash player )
Find an open source program that can do this, and read the portion of the source code that forms the youtube requests.
For example, gPodder is my favorite application of this type, and would be a good choice if you read python code. But I'm sure you can find others.
Once you find out the right format for requests, you can use C#'s HTTP classes such as HttpWebRequest. Finally, save the data to a file.
Google has also provided some documentation for accessing YouTube from .NET, but this is more related to the social networking aspects of the site than the video content.

Limit the length of a video uploaded to YouTube via C#

I'm working on a project that will use the .NET wrapper for the YouTube API. We will provide a form to users where they can upload a video and it will get posted to a specific page on YouTube. We'd like to limit the length of videos that are uploaded to 60 seconds. Is it possible to set such a length limit at the C#-level in the upload code? I was unable to find anything specific about this in the API docs.
I suspect that this cannot be done as you need to upload the actual video first to determine its length.
You will have to resort to saving the file locally on the server before transmitting it to YouTube. You would then have to use a Media Library to load the video and confirm its length before doing any further processing.
See this for an example.
I haven't used the YouTube API, but an alternative may be to upload the video, check its legnth from YouTube and remove it if it is in violation of your limits.
You are correct. You would have to upload and then check the file attributes to determine length. Theoretically, you can query this while streaming, as you can look at the metadata in the header. I have never queried video, so I am not sure how this is formatted. If you head this direction, you can abort the stream if the header has a length attribute greater than 60 seconds.
A possible issue here is certain types of media files don't contain the length attribute. I am not sure about the types one can upload to YouTube, however.

Categories