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
Related
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
I'm currently downloading website via an ActionScript HTMLLoader to later have access to the DOM to get some information out of the page.
The problem is: each resource that is linked on the page (images, stylesheets, javascript) is also loaded which takes some additional time. I don't really need those resources, because only the plain HTML/DOM is interesting.
Is there any way to disable loading of linked resources? At first I tried using an URLLoader and parse the result as XML, but when the website isn't valid this doesn't work. I also didn't find a library that validates/parses a given HTML-string into valid XML.
I'm using Adobe AIR on desktop.
Perhaps convoluted, but you could load the file with URLLoader, convert it to a string, use regex to remove links to the external resources you don't want, and then load the result into the HTMLLoader.
I have created a SWF file using Flash that loads an FLV file on my local development machine. When publishing the SWF file and generating the appropriate HTML, I can successfully load the video by opening the generated HTML page that Flash creates. However, when placing the generated HTML code in my View, the Flash is loading, but the video is not playing. I think it's a reference error to the location of the FLV file, but I've tried every combination I can think of. I placed the SWF and FLV in the corresponding View folder where I want the video to load, but to no avail. Does anyone have a working example that I can look at, or any suggestions? Thanks.
I think it's a reference error to the location of the FLV file, but I've tried every combination I can think of.
Yes, I think so as well. Have you tried using Url helpers to reference static resources on your site, like
#Url.Content("~/Content/Videos/MySupervideo.flv")
The actual solution to this for me was this...
In your Flash file, the Component Inspector should point to the location on the web server where the FLV file is located...
Publish the SWF, copy the appropriate HTML to the View you would like the video to play in...
And just as Darin has pointed out, use the Helpers to write the path to the SWF file on your web server where it is located. The only difference is this (which I discovered using Google's 'Inspect Element' feature and then clicking on the 'Network' item, then clicking the path loaded on the left for the 'SWF'... on the right it stated 404 Status Not Found... why?
#Url.Content("~/Content/video/name-of-swf.swf") actually produced
src='http://localhost/content/video/name-of-swf.swf.swf'
This obviously incorrect... so here is the correct way to use the Helpers...
#Url.Content("~/Content/video/name-of-swf")
Hope this helps someone... I am giving Darin credit because he pushed me in the right direction...
I've been able to play media with a html5 audio element but the duration of the song never displays correctly, and when it plays the progress bar just fills up, although it does play fine. This is what I've been doing. I'm using ogg vorbis files.
Started with jPlayer, had this problem.
Heard the problem might be related to my Jetty server so I switched to Tomcat, but I still had this problem.
Tried using the plain html5 audio element and the problem persisted.
Put a video in my page with an html5 element, and that had the correct duration.
I imported all my audio from CDs using the same program, so although I can see the duration any number of other ways I thought I might try files from some place else. So far every file I try has the problem.
I've been hearing about an Accept-Ranges header but I don't know how to see if I'm using that header, how I would make sure to use the header, or when I would use the header(do I send it with the html page, do I send with with the audio itself? Can I add a header to a file?)
I'm very new to web programming and figuring out the ropes have been tough. In the end I just added the "Accept-Ranges" : "bytes" to every response my server returned. I thought I would have to be careful what responses I added headers to but this is working out. In clojure with compojure which is the language and framework I'm working in I just use a middleware that adds "Accept-Ranges" : "bytes" to the response map under :headers and it looks like there is a setHeaders function in the response object in Java.
I'm making a flash website, I know the basics of html and AS3, but this is my first time trying to use them together. I need only two interactions between the swf file and the server:
The .swf needs to be able to grab image files from a directory hosted on the server
The .swf file needs to be able to change the URL
I'm not sure how complex these things are to do, but I'd like the simplest solution possible. Direct me to a tutorial if you think it is necessary, but the quick and dirty would be appreciated.
Loading images
Changing URL
If you want to interact between flash and the browser you can use ExternalInterface. Here is a simple tutorial on it:
ExternalInterface
Flash can access directory hosted on the same server as long as you have permission, and you can do redirect in AS3 w/ the following code:
var page3URL:String = "http://example.com?" + "x=" +id;
navigateToURL( new URLRequest( page3URL ) );