Scraping youtube video with R, is it possible? - r

I would like to scrape / download youtube videos directly from youtube using R. So to clarify, I'm not interested in the meta data, video titles, or comments as much as the video itself (be it formated as a video or audio file).
Is this possible? And if so, is it legal? I cannot think of a reason why it shouldn't be, given that there exist tools with which one can download single youtube videos as audio files and given also that material published on youtube and openly accessible are literally exactly that: openly accessible and available.
I had a look at {tuber} and {Rselenium} but that is only good for retrieving meta data, not the actualy video or audio content.
Any experiences or suggestions?

Related

is it possible to replace Youtube's Iframe Video Ads

is it possible to replace Youtube's embedded Video's Ads with my own video ads.
maybe using a video player to do that but how can i do?
for example. someone is embedding youtube videos somewhere else. he wants to show some video ads on those videos. how can he do that?
I doubt it is impossible. It is, however, illegal to do so. When using the YouTube Data API or the JS API you agree to their terms of service, which explicitly state that you may not alter or remove in-player ads of embedded videos (section II, paragraph 7).
Is it possible to replace Youtube's embedded Video's ads with my own video ads?
If you own the video the answer is YES, but if it's own by someone, the answer is NO. Only the owner/author of the video have rights to the ads of these video.
For more information, you can check this related SO question. It might give you an idea about your problem.
Also from the YouTube Help, it is stated here that:
You will automatically be opted into showing ads on embedded videos if
you've associated your YouTube and AdSense accounts and have enabled
your videos for embedding. Note that embedded videos will honor the
same ad enablement settings as videos on youtube.com.
If you don't want to show ads on your embedded videos, there is no way
to directly disable ads on just embedded videos, however, you may
disable your videos for embedding altogether.

Identify restrictions in embeddable Youtube videos

I'm having problems identifying playback restrictions of embedded YouTube videos when using YouTube Data API v3.
Example: YouTube ID k85mRPqvMbE and 3n4dXiagrZc seem to share same restrictions when it comes to embedded playback (in my case on an iPhone). The parameters I have looked at are "embeddable" in Video API and videoSyndicated/videoEmbeddable in Search API.
All the "obvious" parameters give the same results for both videos, but while I can play "3n4dXiagrZc" on my device without any problems, "k85mRPqvMbE" refuses to play due to content owner blocking me from watching it (playback through YouTube app or YouTube web works fine though). Please note that I have check the country restrictions as well and my country is not blocked for any of the two.
Any ideas on how to identify videos via the YouTube Data API v3 that are blocked for the reason stated above?
If you do a JSON query, http://gdata.youtube.com/feeds/api/videos?v=2&alt=jsonc&q=videoid you will get the video info. Here look for "embed:allowed", if present the video is embeddable.. Hope this helps! :)

Download youtube video in R

I am trying to write a script in R that will download several youtube movies. This is one of them: https://www.youtube.com/watch?v=nHm8otvMVTs (I come to this youtube page from a course page where the youtube links to all of the videos in this course are provided, so my script will follow that set of links, go to the respective youtube pages, and fetch the mp4's).
Although I have found several discussions on stackoverflow (and elsewhere) on how to retrieve the actual link to the video, I am still totally lost as to how to automatically find it. (also, I keep seeing comments that youtube has recently changed its system, so most of those solutions don't work any longer anyway).
All I need is to be able to recognize the actual link on the youtube html-page (I am find with regex, so once I know what to look for, I can automate it for multiple youtube movies). So the main question remains: how can I find the actual link to the mp4 for youtube pages like this one: https://www.youtube.com/watch?v=nHm8otvMVTs or https://www.youtube.com/watch?v=BO6XJSaFYzk
I would appreciate any help on this, thank you.

How to play audio podcast file from libsyn rss feed? (drupal)

Got an established libsyn rss feed, got a new drupal website for the podcast. Libsyn provides a player but not correct aesthetic. I can upload and play mp3 files with audio module and mp3player module, and like the mp3 player's output, a simple flash player, but I don't want to be manually moving the podcast audio files (mp3) over every week. Looked at importing automatically with Feeds, but it's not working and besides that's creating extra files unnecessarily on the drupal site.
Just want to use the mp3player modulee's flash player in a drupal page, which feeds the latest mp3 file from a libsyn rss feed. Don't really need to store or play multiple episodes, just the latest episode.
How would you do it?
Create a content type for my podcasts with a title and a field for the URL of the MP3
Use FeedAPI and map the title to the title of the node
Map the file URL to the URL field
Use Contemplate to set the URL field to display as [swf file="token_for_URL_field"], which will use the SWF Tools module and whatever player I've selected to play the file
So you need these modules CCK, Contemplate, FeedAPI, and SWF Tools, and that should do the trick.
Why don't you have your own site be the master and libsyn get it from you? Do they not allow an import feature, with which you'd keep your existing RSS through them. Then you can have total control over your site and push the content to all kinds of other great podcasting networks.
Realize I may have no idea about libsyn works.
When you say feeds didn't work, how did it fail? Are you using feed mapper? You may need to write a custom plug-in for feed mapper to get it to do the right thing with the video files. Feed api supports expiring imported feed items so you should be able to get it to automatically delete old ones. I'm not sure whether the video files will be automatically deleted when the nodes are. If not, you should be able to make this happen by implementing nodeapi's delete op for the content type you are using to store your imported rss items.
Alternatively, maybe you could just harvest the video's url on libsyn, and have the player use that. I don't know whether there's a good player which supports using a field's data for the location of the source it should play.
Also, if you haven't already, I'd encourage you to post your question on groups.drupal.org since that's read by lots of drupal experts.

Detecting Youtube video length with Asp.net

Is there any ASP.Net command that can detect how long youtube videos are automatically? On my website people can add youtube videos to the database but I don't wanna have to manually find out the length of every youtube video people add.
You might take a lil' look at the YouTube API. I haven't tried it, but I searched Google for 'YouTube API'.
http://code.google.com/apis/youtube/overview.html

Resources