ViSeR - akoshy/ViSeR GitHub Wiki
YouTube API is potential way for open source programmers to access and stream videos as and when required. Every video has a unique 11 character alphanumeric id. This id can be used to access the data with respect to the video in a recognizable format say JSON or XML.This file would contain all the data on display for the video on the page, including the time duration, views, rating, name of the video, current dimensions of the video player, keywords to search the video etc. These parameters can be accessed through the gdata api for videos through the link "http://gdata.youtube.com/feeds/api/videos/"+ the video id of the video you want to aquire the data of. this is in the form of a xml response which can then be parsed to access the various information present in the xml file. There is a roundabout way to access the video file of the video you are watching by changing the url of the video from "http://www.youtube.com/watch?v="+id to "http://www.keepyoutube.com/watch?v="+id. This website will access the video and provide you with the options to download the video in the format you wish to have.
When it comes to streaming the video from the url the youtube player can be a bit cumbersome. So the VLC comes to rescue. This is an awesome player hat plays anything you can throw at it as long as it is a video/ audio. and you can stream any file in the vlc just by adding the url to the playlist. The playlist can also be accessed from the console by separating the various files to be played by a comma. And when it comes to quit after ending the playlist, you need to add a script as "vlc://quit" which on being played will exit from the player. There is an even better option for linux users who can run cvlc : console vlc to access and run all options without the GUI. For windows user this window is accessed by the menu as "View -> Add Interface -> Console". Here you can have full freedom to experiment as well as view all the operations you can perform in the same.
To run a command from the java console to the command prompt you need to get to execute the command as "Process p = Runtime.getRuntime().exec(command);" This can then using a proper object be used for reading the erros if any and output if any using the GetErrorStream() and getInputStream() functions on the process instance created.Every Java application has a single instance of class Runtime that allows the application to interface with the environment in which the application is running. The current runtime can be obtained from the getRuntime method.An application cannot create its own instance of this class.The Runtime.exec methods create a native process and return an instance of a subclass of Process that can be used to control the process and obtain information about it. The class Process provides methods for performing input from the process, performing output to the process, waiting for the process to complete, checking the exit status of the process, and destroying (killing) the process.The Runtime.exec methods may not work well for special processes on certain native platforms, such as native windowing processes, daemon processes, Win16/DOS processes on Microsoft Windows, or shell scripts. The created subprocess does not have its own terminal or console. All its standard io (i.e. stdin, stdout, stderr) operations will be redirected to the parent process through three streams (Process.getOutputStream(), Process.getInputStream(), Process.getErrorStream()). The parent process uses these streams to feed input to and get output from the subprocess. Because some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, and even deadlock. The subprocess is not killed when there are no more references to the Process object, but rather the subprocess continues executing asynchronously. There is no requirement that a process represented by a Process object execute asynchronously or concurrently with respect to the Java process that owns the Process object.
JSoup is a library used by java to parse a webpage in HTML format givin the user access to all the elements and data on the page.It keeps track of all the nodes in the document as and such so that requisite data can be extracted from the link provided to the same.JSoup is a Java library for working with real-world HTML. It provides a very convenient API for extracting and manipulating data, using the best of DOM, CSS, and jquery-like methods. JSoup implements the WHATWG HTML5 specification, and parses HTML to the same DOM as modern browsers do.
a) scrape and parse HTML from a URL, file, or string b) find and extract data, using DOM traversal or CSS selectors c) manipulate the HTML elements, attributes, and text d) clean user-submitted content against a safe white-list, to prevent XSS attacks e) output tidy HTML
JSoup is designed to deal with all varieties of HTML found in the wild; from pristine and validating, to invalid tag-soup; JSoup will create a sensible parse tree.