flagbug / youtubeextractor Goto Github PK
View Code? Open in Web Editor NEWA .NET library, that allows to download videos from YouTube and/or extract their audio track (currently only for flash videos).
A .NET library, that allows to download videos from YouTube and/or extract their audio track (currently only for flash videos).
Could there be an alternative approach of getting the videos (like vevo's) from the youtube?
My current workaround is taking the cache files from the firefox cache directory and merging the splits to one..
Could there be a way to implement a "browser connetion" or the signatures still will make an issue towards it?
It is found that some videos are not getting downloaded.
Example : http://www.youtube.com/watch?v=WEAWB-sTj0M
I am getting the error
"Could not parse the Youtube page.
This may be due to a change of the Youtube page structure."
Could not parse the Youtube page.
This may be due to a change of the Youtube page structure.
Please report this bug at www.github.com/flagbug/YoutubeExtractor/issues
has been thrown on this youtube ID w28ZREQe3
I'm also getting error 403:forbidden from time to time
edit: it may be an error from my behalf, since im running it on a playlist and some of the links are invalid... will check this out.
apparently
it seems like it's alternatively succeeding in parsing the link, I have no idea why.
seems like it was my fault, I build the project and it replaced the new library with the old one...
https://www.youtube.com/watch?v=V4UGX7rJzvA
cannot be parsed
Does it support socks5 proxy?thank you
When accessing a video blocked by GEMA, it throws an parsing error, instead of a more descriptive error.
This affects many videos with music when accessing them from a German IP.
VideoDownloader.Execute
swallows errors. If the download results in an error, args.Error
of the completion notification will be an exception and not null. You should check it, and throw the exception if necessary.
it has stopped working getting 403.
error code 403: can't access to download urls of vevo videos that have use_cipher_signature=True
Sample video:http://www.youtube.com/watch?v=9Ht5RZpzPqw
Hi there,
Love the project...was trying to make some use of it but i can't seem to download any Vevo videos.
Looking at some of the already open issues and comments i didn't find anything that wasn't in your code already. I'm guessing the issue is with the parsing of the download string and the generated code?
Anyways for this video: http://www.youtube.com/watch?v=H8Tv9j1dqh8
I get this DownloadUrl ":
http://r4---sn-nx57ynes.c.youtube.com/videoplayback?algorithm=throttle-factor&burst=40&sver=3&sparams=algorithm,burst,cp,factor,gcr,id,ip,ipbits,itag,source,upn,expire&id=1fc4eff63d5daa1f&key=yt1&factor=1.25&expire=1376972617&ms=au&fexp=909546,906397,929117,929121,929906,929907,929922,929127,929129,929131,929930,925720,925722,925718,925714,929917,906945,929919,929933,912521,932306,913428,904830,919373,930803,908536,904122,932211,938701,911423,909549,900816,912711,935802,904494,900375,906001&itag=35&ipbits=8&mt=1376949058&gcr=ca&ip=68.179.65.121&mv=m&cp=U0hWS1lSUF9GUUNONl9RTFRHOjlNOFBtS3Y3bERy&upn=uUwzpbfT5uk&source=youtube&fallback_host=tc.v13.cache2.c.youtube.com&signature=AA73CAFE65766436B8A71A2BCDCAD472C3ABA0282.E341B7BDA6B5CF25189E6CCD17778F0341BA56A"
Any idea how i could solve this?
Thanks for all your help.
It was working a few days ago, now it's not.
YoutubeExtractor.YoutubeParseException was unhandled
HResult=-2146233088
Message=Could not parse the Youtube page.
This may be due to a change of the Youtube page structure.
Please report this bug at www.github.com/flagbug/YoutubeExtractor/issues
Source=YoutubeExtractor
StackTrace:
at YoutubeExtractor.DownloadUrlResolver.ThrowYoutubeParseException(Exception innerException)
at YoutubeExtractor.DownloadUrlResolver.GetDownloadUrls(String videoUrl)
at XbmcTube.Video.GetDownloader(String destination)
at XbmcTube.Channel.DownloadAll()
at XbmcTube.Program.Main(String[] args)
InnerException: System.Collections.Generic.KeyNotFoundException
HResult=-2146232969
Message=The given key was not present in the dictionary.
Source=mscorlib
StackTrace:
at System.Collections.Generic.Dictionary2.get_Item(TKey key) at YoutubeExtractor.DownloadUrlResolver.<ExtractDownloadUrls>d__0.MoveNext() at YoutubeExtractor.DownloadUrlResolver.GetVideoInfos(IEnumerable
1 downloadUrls, String videoTitle)
at YoutubeExtractor.DownloadUrlResolver.GetDownloadUrls(String videoUrl)
My calling code:
public VideoDownloader GetDownloader(string destination)
{
var video = DownloadUrlResolver.GetDownloadUrls(this.watchurl).First();
return new VideoDownloader(video, destination + video.VideoExtension);
}
DownloadUrlResolver.GetDownloadUrlsAsync(url); throw a System.Net.WebException on WP 8.1.
The problem is in the class HttpHelper, in the method
public static string DownloadString(string url):
request.EndGetResponse(asyncResult) throw the exception.
I fixed it by setting the user-agent of the request (user agent of google chrome):
request.Headers["User-Agent"] = "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36";
for some reasons youtube seems to refuse request that have the new wp ie in the user-agent.
Anyone got a fix for this?
Seems to be VEVO videos but not 100% sure.
Thanks guys
Im trying to use Youtube Extractor on a App for Windows Phone 8 writen in VB.
When i try:
Dim videoInfos As IEnumerable(Of VideoInfo) = DownloadUrlResolver.GetDownloadUrls("Link")
the App stops responding.
Tried using GetDownloadUrls, but crashes into:
Diagnostics.Debugger.Break(), of App.xaml.vb
Public Sub Application_UnhandledException(ByVal sender As Object, ByVal e As ApplicationUnhandledExceptionEventArgs) Handles Me.UnhandledException
' Show graphics profiling information while debugging.
If Diagnostics.Debugger.IsAttached Then
Diagnostics.Debugger.Break()
Else
e.Handled = True
MessageBox.Show(e.ExceptionObject.Message & Environment.NewLine & e.ExceptionObject.StackTrace,
"Error", MessageBoxButton.OK)
End If
End Sub
Hello
Nice project.
But I obtain "The remote server returned an error: (403) Forbidden." in VideoDownloader.cs file on method "Execute" in line:
using (WebResponse response = request.GetResponse())
I am executing the sample project.
Thank you very much.
Regards
Trown Parser Exception on this video:
http://www.youtube.com/watch?v=yXMU2qwCVag
I'm using a custom downloader to get the video from the url provided by youtube extractor, and it keeps throwing "403 forbidden" when trying to download the video. I've tested in 3 machines and its done the same sadly.
Q:
Hi.
Are you relying (as me) on gantt's GreaseMonkey script at http://userscripts.org/scripts/show/25105 ?
I'm asking, just out of curiosity, because I noticed the same method named after "DecryptSignature", in both latest versions of your sources.
Or maybe YOU are gantt, or HE looked at your souce ;)
Otherwise, I'm not sure is this is necessary, but a notice in your README would be appropriate.
I wrote this on a Windows Phone 8 app:
string link = "http://www.youtube.com/watch?v=DYW50F42ss8";
IEnumerable videoInfos = DownloadUrlResolver.GetDownloadUrls(link);
VideoInfo video = videoInfos.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360);
When its try to invoke the method GetDownloadUrls I need to wait a lot. What I doing wron?
Url is: http://www.youtube.com/watch?v=vv9_z6Cdf3g
Could you please add a possibility to login to youtube.
Message is:
"Could not parse the Youtube page.
This may be due to a change of the Youtube page structure.
Please report this bug at www.github.com/flagbug/YoutubeExtractor/issues"
I'm getting the following error: "Could not parse the Youtube page. this may be due to a change of the Youtube page Structure. please report this bug at ..."
for every file i try to get. since today morning
Hi,
just downloaded your stuff with nuget, and entered a small video url, but it is still running. already for 15-20 mins. this is the youtube video http://www.youtube.com/watch?v=ehbrEPZZnlo
wants to extract an audio from a small youtube video.
i downloaded the zipped package as well, but in VS2010 i cannot open.
thanks in advance giving me a hint what could be an issue.
Ivan
Hi,
previously this url worked for me to enumerate and download all included videos:
http://www.youtube.com/playlist?list=PL298B627617DC1FC5
After the change with the current 0.3.1 it does not work anymore.
Hi, I have an error:
Could not parse the Youtube page.
This may be due to a change of the Youtube page structure.
Please report this bug at www.github.com/flagbug/YoutubeExtractor/issues
at YoutubeExtractor.DownloadUrlResolver.GetDownloadUrls(String videoUrl)
Today is looks like all signatures being 82 in lenght and Decripter is not working... I tried some things like not decripting 82 lenght but nothing.
For this, we need to convert this script into C#
require 'open-uri'
def decipher_function_name_pattern
# Find "C" in this: var A = B.sig || C (B.s)
/
\.sig
\s*
\|\|
(\w+)
\(
/x
end
def function_body_pattern
# Match nested angle braces
/
(?<brace>
{
(
[^{}]
| \g<brace>
)*
}
)
/x
end
def function_pattern(function_name)
# Match the function function_name (that has one argument)
/
#{function_name}
\(
\w+
\)
#{function_body_pattern}
/x
end
js = open("http://s.ytimg.com/yts/jsbin/html5player-#{ARGV.first}.js").read
deciph_func_name = js[decipher_function_name_pattern, 1]
deciph_func_pattern = function_pattern(deciph_func_name)
body_match = deciph_func_pattern.match(js)
raise "could not extract body" unless body_match
body = body_match[:brace]
lines = body.split(";")
# The first line splits the string into an array and the last joins and returns
lines.delete_at(0)
lines.delete_at(lines.size - 1)
lines.map! do |line|
if /\(\w+,(?<index>\d+)\)/ =~ line # calling a two argument function (swap)
"w#{index}"
elsif /slice\((?<index>\d+)\)/ =~ line # calling slice
"s#{index}"
elsif /reverse\(\)/ =~ line # calling reverse
"r"
else
raise "Cannot parse line: #{line}"
end
end
cipher = lines.join(" ")
puts cipher
on this url:
http://www.youtube.com/watch?v=dpWEv9Q0XQ4
The remote server returned an error: (403) Forbidden.
Hello, first thanks for the good work, keep going with the good work!
I am really able to help ether to make this, the best extraction methotd.
I have a question because i recently found this script!
You says: "Note that Windows Phone 8, WinRT, Xamarin.Android and Xamarin.iOS only support the extraction of the download URLs", this means that in wp8 i can not extract the video url to mp3?
I know that if we try to extract from flv there is no need to encode or decode the the music stream, so in wp8 we can download and extract the audio from the url?
YoutubeExtractor gives the below when I use it to download an audio of a youtube video .
Could not parse the Youtube page.
This may be due to a change of the Youtube page structure.
BTW, I use your YoutubeExtractor and combine it to my music player.
It's really convenient. Thank you very much!
It seems YouTube has caught up again. These videos won't download for instance:
The "decipher" string is empty resulting in 403 errors.
The script at http://userscripts.org/scripts/review/25105 still works. However it is written in Javascript and rather difficult to convert to C# (by me that is). Perhaps you could use this?
For me I get a lot of 403s since like 2 days.
Youtube disabled 1080p download, any chance to get it back in this program?
GetDownloadUrls()
returns shared instances of VideoInfo
. However, for each call it sets the DownloadUrl
and Title
properties on the shared instance. Therefore, it cannot be called concurrently, because one thread may overwrite the values returned on another.
I believe the simplest solution is to not return shared instances of VideoInfo from GetDownloadUrls().
http://www.youtube.com/watch?v=kDWgsQhbaqU
many others
e.g a property called IsDeciphered
This occurs when...
That would be great if you could fix this bug or at least have it so it doesn't crash and gives you an error.
Hi there,
I'm Essam, a developer in YouTubeFisher project; I've been following your project for a while now and like the work you're doing in this project.
I have a note though regarding the audio extraction functionality in your library. We, in YouTubeFisher, are using the excellent code from FLV Extract project by J.D. Purcell which is published under GNU-GPL. This code doesn't belong to YouTubeFisher and we do not maintain it.
It makes sense to give credit to the code author, for this reason, I've created a NuGet package FlvExtract which will be used by YouTubeFisher in the future releases and hope you reference it as well instead of bundling the code in your library.
Have a nice day.
I can't find a method to abort the execute function.
Am I missing something?
Edit:
Sorry to be a noob.
I was looking through your updates and it seems you added this a day ago.
I realize this isn't a forum but am I doing this right? :3
Does this actually cancel the download or just the progress updates?
audioDownloader.DownloadProgressChanged += audioDownloader_DownloadProgressChanged; void audioDownloader_AudioExtractionProgressChanged(object sender, ProgressEventArgs e) { if (isDownloading) progressBar.Value = (int)(85 + e.ProgressPercentage * 0.15); else e = e.Cancel; } }
Overriding VideoInfo.ToString
makes debugging a lot easier, since when viewing a list of VideoInfo
s, you can tell at a glance which formats were offered. I suggest something like the following:
public override string ToString()
{
return VideoFormat + " " + Title + VideoExtension;
}
Why does your repo use 26 MB? Did you accidentally commit some large files in a former revision? If so, rewriting history to remove it might be a good idea.
The license GPLv2 does not seem to be compatible with apples app store so why provide a Xamarin.iOS version?
I use the version 0.10.0.0, release since 18h. But it not working correct. It raise here:
string url1 = "https://www.youtube.com/watch?v=FQcjIZCOfvM";
YoutubeExtractor.DownloadUrlResolver.GetDownloadUrlsAsync(url1);
Make it easier to download the highest quality video that's available. Some kind of quality indicator in the VideoInfo class would be nice to do this. For example use vertical resolution (360, 480,...)
http://www.youtube.com/watch?v=1dNI74FZ6Vc
Please let me know the issue.
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary2.get_Item(TKey key) at YoutubeExtractor.DownloadUrlResolver.<ExtractDownloadUrls>d__0.MoveNext() at YoutubeExtractor.DownloadUrlResolver.GetVideoInfos(IEnumerable
1 downloadUrls, String videoTitle)
at YoutubeExtractor.DownloadUrlResolver.GetDownloadUrls(String videoUrl)
--- End of inner exception stack trace ---
at YoutubeExtractor.DownloadUrlResolver.ThrowYoutubeParseException(Exception innerException)
at YoutubeExtractor.DownloadUrlResolver.GetDownloadUrls(String videoUrl)
at Youtube_DL_GUI.Form1.DLST_Click(Object sender, EventArgs e) in D:\Wack\Src\Youtube DL GUI\Youtube DL GUI\Form1.cs:line 180
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
public static IEnumerable GetDownloadUrls ( string videoUrl );
When detecting the VideoType
, you forgot the case for WebM 480p.
Add a case 44
in VideoInfo.VideoType
.
The following Url is not recognized by DownloadUrlResolver
http://www.youtube.com/v/I9TpTR4o9dg?version=3&hl=de_DE
the problem is that it turns it into:
http:/youtube.com/watch?v=I9TpTR4o9dg?version=3&hl=de_DE
if the 2nd "?" is replaced by "&" all is fine.
Additionally local youtube urls are not recognized, like
http://www.youtube.de/v/I9TpTR4o9dg
To reproduce, disable network adapter during download
System.Net.WebException was unhandled
HResult=-2146233079
Message=An exception occurred during a WebClient request.
Source=YoutubeExtractor
StackTrace:
at YoutubeExtractor.VideoDownloader.<>c__DisplayClass2.b__0(Object sender, AsyncCompletedEventArgs args)
at System.Net.WebClient.OnDownloadFileCompleted(AsyncCompletedEventArgs e)
at System.Net.WebClient.DownloadFileOperationCompleted(Object arg)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
InnerException: System.IO.IOException
HResult=-2146232800
Message=Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
Source=System
StackTrace:
at System.Net.Sockets.NetworkStream.BeginRead(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.PooledStream.BeginRead(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.BeginReadWithoutValidation(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.BeginRead(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.WebClient.DownloadBitsState.RetrieveBytes(Int32& bytesRetrieved)
at System.Net.WebClient.DownloadBitsReadCallbackState(DownloadBitsState state, IAsyncResult result)
InnerException: System.Net.Sockets.SocketException
HResult=-2147467259
Message=An existing connection was forcibly closed by the remote host
Source=System
ErrorCode=10054
NativeErrorCode=10054
StackTrace:
at System.Net.Sockets.Socket.BeginReceive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)
at System.Net.Sockets.NetworkStream.BeginRead(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
InnerException:
I use this code for getting urls:
IEnumerable videoInfos = null;
videoInfos = await DownloadUrlResolver.GetDownloadUrlsAsync(LinkV);
But I have error "ApplicationUnhandledException" in my application for Windows Phone 8.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.