as3 check if youtube link exists - actionscript-3

I want to give users of an app the possibilty to post a video from youtube by entering an url in a textfield. To ensure that the link exists, I want to check the url.
I only found examples to check if an external file exists but not how to check a simple www link. How can I check this?

Youtube doesn't really have a 404 page, so you'll always end up loading a page...
I don't know how you'll be loading the page...whether javascript will come into play once the page is loaded and take the argument of the video id...
But if all that goes through.... You'd want to look for this sniped of data in this div to determine whether or not the video exists.

Related

Cannot create direct link to image hosted online

I was just trying to add a background image from http://wallpaperswide.com/rocky_peak-wallpapers.html to my website.
The link to the particular image is http://wallpaperswide.com/download/rocky_peak-wallpaper-1920x1080.jpg.
However, if I try to load the image from the second link, it doesn't load. If I paste the URL into my browser, it redirects me to the first link.
Why does this happen? Thanks.
Edit
I'm getting some answers that there is an HTTP redirect. I know I can download the file and use locally.
However, the problem is that I'm writing a script that dynamically takes an image from the wallpaperswide.com site and automatically getting the image that fits the person's screen resolution. I just scan the page for the links and try to use those links. I can't download every image from the site and have them locally...
Any suggestions?
Because http://wallpaperswide.com/download/rocky_peak-wallpaper-1920x1080.jpg is not an image, it's a document.
HTTP urls always point to documents, therefore the web server is able to process it and give you the appropriate result.
The website author has added a 302 redirect rule while accessing the links directly, so you can't embed that link directly. Instead, you can download and refer it.

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.

Get youtube video url form webpage source

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

Displaying any point in youtube iframe initially

I know that I can use embed parameters such as &start=10, but I would like to know if there is an option that could load the iframe showing a different time in the video for image purpose, and possibly still start at the beginning.
YouTube doesn't allow you to set custom frames as stills - I think it gives you some options to choose from when you upload your video, see more info here: http://www.squidoo.com/youtubeframe

Scope of window.URL.createObjectURL (html5)

I'm building an html5 application and I'm struggling with the scope of the createObjectURL method.
To give you some information on my application to help you understand my issue:
- page 1: the user submits his video and I'm fetching info about his video (IMDB info mainly)
- page 2: this is the page where the video is actually played.
Now my question: when the user submits his video on page 1, can I create the blob url (createObjectURL method) and pass it to page 2 to play the video or is it out of scope?
The explanation is rather ambiguous on this page: "Blob URLs are unique and last for the lifetime of your application (e.g. until the document is unloaded)": page 1 and page 2 are in the same application but the document will be unloaded between those two pages right?
Thanks
So it seems that indeed blob URLs in html5 have only the page as a scope!
The two solutions that I found to tackle the problem described above are:
1. Put everything in the same page (you can modify the page with js for example)
2. Or use an iframe to load the second page "in" the first one.
Hope that can help someone out there.