Get youtube video url form webpage source - html

Is it possible to get the download URL of currently playing video from source of YouTube webpage?Thanks in advance.Please help me.
Actually I have a downloader but it is not working now.When I have tried with the URL provided by the downloader in browser it returns an error page says "Access to the webpage was denied".The Url that I got for a video is as
" http://r14---sn-h557snel.c.youtube.com/videoplayback?gcr=in&ip=121.241.181.70&upn=OOcjKEO_S6I&cp=U0hUTFZQT19KU0NONF9OSlNGOmFRT2JSUUs2bDVi&ipbits=8&fexp=900148,920704,912806,928001,922403,922405,929901,913605,929104,913546,913556,908496,920201,913302,919009,911116,901451,902556&ms=au&mt=1357625350&mv=m&id=31a79fcdbfc6c2f6&sparams=cp,gcr,id,ip,ipbits,itag,ratebypass,source,upn,expire&expire=1357651559&itag=18&key=yt1&newshard=yes&source=youtube&ratebypass=yes&sver=3"
Few months before the format of URL was
" http://o-o---preferred---sn-h557snes---v24---lscache3.c.youtube.com/videoplayback?upn=AmmxhSpq470&sparams=cp,gcr,id,ip,ipbits,itag,ratebypass,source,upn,expire&fexp=917013,906437,916626,922401,920704,912806,927201,925706,922403,913546,913556,916805,920201,901451&ms=au&expire=1353668177&itag=18&ipbits=8&gcr=in&sver=3&ratebypass=yes&mt=1353646087&ip=121.241.181.70&mv=m&source=youtube&key=yt1&cp=U0hUSFZRVl9MUUNONF9OS1pCOmhtUTVMak5oTVNy&id=c429fa5466ee9447&newshard=yes "
So I don't know whether the downloader gives the correct URL. Please help me

Sorry I looked around and I couldn't find a way to directly download the source file from the youtube link. There are some guides out there but they all are around 2009; and since youtube changes their code a lot currently none of them work.
Although there are many websites, addons, apps that allow you to download videos; but I do not think they work from a code from the link. Since to watch a video you have to temporarily download it I think they all use a method of opening the page, playing(downloading) the video and actually saving it. I would list those websites and addons but since those sources are not that hard to find; I assume you are trying to build your own downloader and not use one that is already out there.
Also on another note if you could somehow get a link to a videos source file. I am sure youtube has permissions blocked access on all folders and files on their backend for security measures; only allowing those files to be forwarded and displayed on the actual player page. And if you think embedded videos would somehow work they still just make a request to youtube which youtube then gives back video-feed-data so there still is no direct connection to the file.

You should use the player API https://developers.google.com/youtube/js_api_reference#Retrieving_video_information
player.getVideoUrl():String
Returns the YouTube.com URL for the currently loaded/playing video.

I have written a simple python code that can fetch youtube href from html code.
hope it can help you:
#!/usr/bin/env python
import re
pattern = '.*<(iframe|param).*(src|value)="(?P<link>http://www.youtube.com/(embed|v)/[a-zA-Z0-9/\.\?&;=\+_-]+);?.*".*>.*</(iframe|param)>.*'
action = re.compile(pattern)
result = action.findall('<div><iframe.....></iframe><param......></param></div>')
print result
https://gist.github.com/Mortezaipo/5707738

Related

I keep getting a 404 from the youTube API V3 in AS3

We are actively working on moving our product from AS3 to HTML5, but until we complete the process we still have many clients using the Flash version of the Youtube API V3. We have gotten our project Key and are making the request with https://www.youtube.com/apiplayer?version=3&key=[key], it returns a 404 when the AS3 goes to get it, but returns the flash API when pasted into the browser directly.
We have Security.allowDomain("www.youtube.com"); in the code.
Here is how we are loading the API, which has worked for years.
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);
var url:String = "https://www.youtube.com/apiplayer?version=3&key=*[key]*";
_loader.load(new URLRequest(url));
Trying to figure out what i'm missing.
The Youtube API is no longer working with AS3 code.
I don't think any remaining SWF versions of player will last long. Consider for any video ID, Having /embed/ used to give the HTML5 player or else using /v/ gave you SWF player. Now both link types return an HTML5 player. They have already started changing things.
Examples:
HTML5 : https://www.youtube.com/embed/1SnPedRxEIU
SWF (but now changed to HTML5) : https://www.youtube.com/v/1SnPedRxEIU ( edit: Seems this URL returned a direct link to the SWF file. Now Chrome browser asks to download, with no browser view unless contained in html file).
The only solution is to move faster to HTML5 (Youtube expects this for browser playback).
For anyone else interested, there's the final option to just extract video file path directly from the video page's source code or instead get a JSON by using http://youtube.com/get_video_info?video_id=xxxx. From either returned text (site source or JSON) you can decode the Unicode & HTML entities to reveal the file URL. The advantage of parsing page source is that you'll find even 1080p links, but JSON version is easier to work with.
you can try this solution, for me it worked https://github.com/myflashlab/AS3-youtube-parser-video-link

Using Instagram API for simple web page

So I am working on a fairly simple project, basically a web page that should list the captions from a certain instagram account. It's all designed, it just needs to be lit up with the content. Have a look at http://evanshellborn.com/speechofthebeets/.
I found that you can see a json file containing all the necessary data at instagram.com/{username}/media. So in my case, https://www.instagram.com/beets_are_life/media/. So before I put that page actually online, I was on my local machine, and I did a JSON call to that page and it worked perfectly. So I built it all out and my web page loaded the captions just like I wanted it to.
Then I went to put it online, (http://evanshellborn.com/speechofthebeets), but it doesn't work. Have a look at the script at the bottom of it, on my localhost that code works and the captions get loaded. But on the live page, I get an access not allowed error in the console. So I think Instagram doesn't allow this sort of direct access anymore, you have to go through their API.
Now I've tried looking at the API but it seems rather confusing. Basically what I'm asking for is a different JSON url that would give me the same result as https://www.instagram.com/beets_are_life/media/, but that would work from the live page.
I think https://api.instagram.com/v1/users/{user-id}/?access_token=ACCESS-TOKEN would work, just replacing {user-id} with the appropraite user_id. But where do I get an access token?
From reading https://www.instagram.com/developer/authentication/, it looks like you get one when a user puts in their user credentials. But I don't want to have anyone log in, I just want a simple web page.
Hopefully that made sense. How can I do what I want?
Looks like the API url https://www.instagram.com/beets_are_life/media/ does not support jsonp (no callback support), so u cannot use javascript (client side) for making API request, it will fail because of Access-Control-Allow-Origin error on browser side, you have make this API call on server side as proxy.
I guess https://www.instagram.com/<USER_NAME>/media/ is not a publicly documented API, thats the reason it is not supporting jsonp, Instagram uses it for their website and since it is same-origin it will work for them on client-side
This link will help you embeding the instagram on a simple html webpage.
There is a button on the bottom of the post on instagram.when you click on the link a menu pops up. then click on embed
now a box pops up
just copy paste the html and you are done.
it will fetch the post for you

Do not show the URL in page source

I have some copyrighted audio files that I would like to protect from download, but show them on the website(drupal).
I have a player that works with flash and css on a link, but if you view the page source the href of the link is visible, and it is very easy to get the URL and get the files locally.
I understand that it's not possible to prevent it 100%, but what I would like to do is just to make it more difficult than seeing the url in the page source.
How can I do it?
I would like to avoid to write myself a player, because my flash knowledge is quite limited...
I'm already hidding with Javascript the link while hoovering with the mouse of the player(which is acctually a link in terms of HTML).
I've tried an HTML obfuscator(http://htmlobfuscator.com), but it does not work properly, for one link it works, for the second and third one it doesn't...
Many thanks
Ultimately, any file which is simply embedded has to be downloaded to the user's computer in order to be played (usually it is downloaded to a temporary location then removed, but a savvy user will be able to capture the download and save it.
If you want any real protection, you'll have to use a streaming server like Helix Streaming Server. With these, the file is not downloaded by default and the user's only real capture option is an audio cable from LineOut to LineIn. Most don't have access to this.

how to capture online audio stream or get its url?

When access the website:
http://www.macmillandictionary.com/dictionary/british/propensity
Click the "pronunciation" button, it will pronounce the word.
But I could not find the url of the audio file from the page source of the webpage.
Is it possible to get the url of the stream file?
Thanks
That one maps to http://www.macmillandictionary.com/media/british/uk_pron/p/pro/prope/propensity_British_English_pronunciation.mp3.
You can find it under the Network tab of your favorite debugger (firebug, chrome console, etc)
It's pretty easy to find, on row 237:
http://www.macmillandictionary.com/media/british/uk_pron/p/pro/prope/propensity_British_English_pronunciation.mp3
But I'm quite sure Macmillan Publishers Limited won't like you copying their audio files. They own the content of their site.

Hide mp3 url while playing audio file

I have a webpage that offers dynamic downloading of mp3 files through mobile phones. I would like to add a feature where someone can listen to the song through their desktops before downloading the file.
The challenge is, I don't want the mp3 file link to be displayed in the page code, I would prefer a different url e.g
<a href='http://mysvr.com/getfile/121233444/'>Preview song</a>
which is passed on to a player that expects an mp3 file source and get it to play the file.
I don't want the person previewing the file not know the real url of the file that is playing to prevent unauthorised downloads.
What do I need to do?
First deny all the access to the directory which has mp3 files through the internet. Then write a handler file to play the mp3's. The handler file will get the name of the mp3 from query string and play the file on player. Taking the url , parsing and playing will be done in codebehind so users wont be able to see the url of the mp3
hope it helps.
This would depend on your setup. The only real way to not make it visible would be to use server side code (php, asp etc). Any client side code is by definition visible to the end user. You could try to obfuscate the link e.g. using some minimized JavaScript hidden away somewhere, but it will always be visible to anyone who searches hard enough.