I'm writting FLV media player and want to know if there is there anyway of accessing the underlying FLV files used by YouTube from a URL? There used to be a bunch of ways of doing it, but YouTube have changed things about and I now can't find any way of doing it...
From what I've seen so far, the YouTube API doesn't seem to give access either. Has anyone found a way of doing it?
Cheers!
There are two values associated with a YouTube video: an ID and a signature. The ID is simple to get, as it's in the URI itself. The signature is a bit trickier to get. It's embedded in a Javascript statement in the source code of each video page.
For example, let's take the Numa Numa video.
It has an ID of KmtzQCSh6xk, as can be seen from the URI.
To get the signature, we have to dig into the source code of the HTML. To easily do this in Firefox, load the source of the page by right clicking anywhere on the page and click "View Page Source." After that, press Ctrl+F, and type in "t":. It will take you to the signature of the page: the value directly after that in quotes is the signature.
In the case of the Numa Numa Dance, it's signature is vjVQa1PpcFOSvCcjdAYSc3ZQgK-6EG9yQM7RLSYqJk4%3D
To get the actual FLV, you enter this URI:
http://www.youtube.com/get_video?fmt=5&video_id={ID}&t={SIGNATURE}
The complete URI to get the FLV video is:
http://www.youtube.com/get_video?fmt=5&video_id=KmtzQCSh6xk&t=vjVQa1PpcFOSvCcjdAYSc3ZQgK-6EG9yQM7RLSYqJk4%3D
You can use this information to help you get the signature and ID you need to download the FLV programatically. Whether it's doing a simple String.Find for the value "t": or using RegEx, it should be simple to find until they change it.
Related
I'm trying to find a way to give my application a YouTube URL (as copied from the address bar in a browser) and extract the unique video ID from that URL. I want to stay away from regex or any other string manipulation as a solution since not all YouTube URLs are the same and may continue to change.
There has to be some way to use the YouTube API for .NET (specifically C# for my solution) to simply call a method/function, pass the method the URL for the video, and finally the method would return the video ID as a string.
I've been trying to find documentation on this and so far I can only find info on using methods to retrieve data about a video based on already having and providing the video ID - which I do not have at this point.
I recognize which part of the YouTube URLs identify the video, but the users of my application should not have to be concerned with that.
It would be greatly appreciated if anybody could help me find a solution here.
Thanks!
Unfortunately I do not think this will work. But then again, I don´t understand the problem you have with using the URL. The URL in itself is a kind of an ID and the v property of the URL specifies which video it is. It seems you already know this.
Regarding your problems with using an URL:
Not all YouTube URLs are the same
R: No, but it doesn´t matter because using RegEx you would only read the v property (v=-l6P7VFKnW8), alternatively the short be variant
YouTube URLs may continue to change
R: Yes, they may. However it is unlikely that YouTube would change the identifier anytime soon because of the effects it would have on API's and other infrastructure. Besides, if you have a pure and modular generic solution you wouldn´t have to change more than one RegEx to comply with the new Id.
Related: Youtube .NET Data API: Retrieve only videoID?
Related: C# regex to get video id from youtube and vimeo by url
I am writing a program that automatically start up a web browser to a song of choice, so in order to do this my program is using an httwebrequest/response to
get the source code of a webpage that contains a link to the audio source page
search through that website source code and find the audio source website
open up chrome the the specified webpage, so i can listen to the song.
I am using project.com as my audio source, and I do not plan on using another site such as youtube
The problem I am having, is that, while I can see a link to the audio source website when i load the initial website in chrome, the page source does not contain it. For instance, this website which
has a link to the audio source http://pl.st/s/1709472017 where you can actually see on the initial website, but when I look at the page source using chrome, then I cannot find this audio source link.
If I right click on the audio source textbox and select inspect element, then I can see this:
<input class="copy-song-link"
type="textbox"
value="http://pl.st/s/1709472017"
name="url"
onclick="javascript:select();" title="Copy and share this song URL">
so this link is clearly located somewhere. My questions are these
why/how is this link not in the source page, but i can see when i look at the website through chrome
how come chrome's "inspect element" can find this url, while the page source does not include it.
How does the inspect element differ from looking at the source code?
I am pretty new to http communication so any help would be appreciated.
I generally use the plugin Firebug for Firefox for situations like this. It will allow you to use the "Net" tab to inspect all subsequent requests (often Ajax) that occur while the page is loading.
In your case it appears an Ajax request was collecting the data that is being used to generate the link that you want to pull out. This data appears in JSON and JavaScript is likely generating the links on the client side from the JSON. Take a look at this link
http://www3.playlist.com/async/searchbeta/tracks?searchfor=r%20u%20mine
The linkid used to generate the link is in the first part of the response ...PPL.search.trackdata = [{"linkid":1709472017...
I am working on an app that downloads various kinds of media from different places- a lot of them user entered. I'm discovering that a lot of the content-types found in the http response are garbage. Mostly for videos it seems. So an example would be a .wmv file somewhere on the web, but when I go grab it it says its content type is text/plain.
Is there some way to check file types besides this response content-type? I was reading a bit about magic numbers for files, but I'm not sure how reliable that is... maybe it's more reliable than the response content-type?
Suggestions or thoughts?
The only fool proof way is to actually try and open the file (with your application) and see if it gets parsed correctly.
However, if you want an API that you can use that will try and determine what the proper MIME type is from given data you can use FindMimeFromData. While this is a native Win32 function, you can still use it through p/invoke.
im starting the pseudo code of a new site, and want it to be as SEO friendly as possible.
the site i am creating is a booking agency site with c# and asp.net. essentially bands will register on the site with their availability and other info, and fill out their profile information with images etc. this info will be stored in a db.
creating this is not a problem, but i want the site to be a SEO friendly as possible.
I know google loves huge sites with great content. And all of these profile pages would be an excellent addition to my site for seo purposes. i also hear that google cannot see dynamically generated content when crawling a site.
i want to find a method of coding these pages, so google can see the content when it crawls them.
i need a pointer in the right direction for a solution for this. nothing is off limits - i will basically code my entire site around this principle, i just have no idea where to start looking for a solution. im not looking for a code solution, just what i should be researching to solve this issue.
Thanks in advance
i also hear that google cannot see dynamically generated content when crawling a site.
Google can see anything you can retrieve via http GET request (ie: there's a specific URL for it) and that someone either linked to or is listed in a published xml site map file.
To make sure that your profile pages fit this, you will want to make sure that profiles are all rendered via a single asp.net *.aspx file that determines which page is shown via a url parameter. Something that looks like this:
http://example.com/profiles.aspx?profile=SomeBandName
Now, you probably also want a friendly URL, that looks like this:
http://example.com/profiles/SomeBandName
To do that, you need to set up routing.
In order to crawl and index your pages by google or other search engine properly. Follow the following guidelines.
i: Page title must be precise and according to content available in page.
ii: Page url should be user friendly.
iii: Content is king (useful content)
iv: No ajax or javascript oriented way to load contents.
v: No flash or other media files. if exist must have description via alt tag.
vi: Create url sitemap of all static and dynamically generated contents.
vii: Submit sitemap to google and keep tracking how google crawl and index your pages.
fix issues contineously if google found via crawling.
In this way your most pages and content will be index properly and fastly.
I'd look into dynamic URL Rewriting.
Basically instead of having one page say http://localhost/Profile.aspx you'll have a bunch of simulated urls like
http://localhost/profiles/Band1
http://localhost/profiles/Band2
http://localhost/profiles/Band3
etc.
All of those will then map to back to the orgial profile.aspx page with a parameter so internally in your code it would look like http://localhost/Profile.aspx?Name=Band1, http://localhost/Profile.aspx?Name=Band2, etc
Basically your website appears to have a bunch of pages for each band but in reality they are all getting mapped back to the same asp.net page but have different parameters.
This is article I read about it some time back. http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
i also hear that google cannot see dynamically generated content when crawling a site.
you could create a sitemap.xml with the urls pointing to the dynamic profile pages. using google webmaster tools you can submit and monitor the crawling progress.
you may also create an index page or something similar ('browse by category' pages) that link to matching profile pages.
a reference for seo I regularly use is http://www.seomoz.org/learn-seo
I wish to play video content (in a container) from my website/ blog when the page is loaded. This would be similar to that of YouTube, Dailymotion etc...
I would like to have the actual URL in the container which would then play the video at the location of the URL. The basic idea is to hide the actual URL from the user and make the person to view the video from the current page.
Could someone suggest some feasible ideas to accomplish this?
Thanks,
Vijay
A quick Google search turned up:
JW Player
There are other FLV players out there (this one also claims to handle MP4), and that's only one possible format. Any more detailed answer would require answering what format you want to serve up, whether you want streaming capabilities, etc.
What I've seen a lot of sites do (NBC Video Player for example), is the following:
Create a VideoPlayer.swf which has the video player functionality.
Pass in a cryptic key to the VideoPlayer.swf via swfobject and flashParams
VideoPlayer.swf sends that key to the server.
Server sends back video data somehow to VideoPlayer.swf and it does its thing.
If you go to this NBC Office episode at http://www.nbc.com/The_Office/video/episodes/#vid=1200746, and look at the source, you won't find that 1200746 value anywhere, so maybe it's not in flashParams. Looks like they store that in an init.xml file via <videoID> 1200746</videoID>, and they probably use SWFAddress to map that #vid=1200746 anchor to that xml file in VideoPlayer.swf, send it to their secure server, and return the video and ads they want.
Hope that helps,
Lance