ruuk / script.module.youtube.dl

⛔️ DEPRECATED: Access to youtube-dl stream extraction in an XBMC module
GNU General Public License v2.0
39 stars 40 forks source link

Fail on resolving Sohu video URL #2

Closed hojel closed 10 years ago

hojel commented 10 years ago

In original youtube-dl, the Sohu URL is converted to the proper URL with the message: [debug] Command-line args: ['http://my.tv.sohu.com/u/vw/69428621', '-v'] [redirect] Following redirect to http://my.tv.sohu.com/us/209274639/69428621.shtml

This module, however, reports the following error message. NOTICE: script.module.youtube.dl - _getYoutubeDLVideo() failed::getVideoInfo (392) - ERROR: no suitable InfoExtractor: http://my.tv.sohu.com/u/vw/69428621

It seems it treats redirection as error.

ruuk commented 10 years ago

Maybe I need to update the youtube-dl core, as this may be something that was fixed since the last time I did it. I'll check it out soon.

ruuk commented 10 years ago

I updated the youtube-dl core to 2014.05.19 and updated the module on my addon repository. Could you test the new version and see if it fixes the issue? If not I'll dig deeper into the code and see what's up.

ruuk commented 10 years ago

Also, if you add a line similar to this to your code the module will print the tracebacks:

import YDStreamExtractor
YDStreamExtractor.DEBUG = True
ruuk commented 10 years ago

I took some time to look closer at the code.

Looking at the youtube-dl code for the sohu extractor the URL regex is:

_VALID_URL = r'https?://(?P<mytv>my\.)?tv\.sohu\.com/.+?/(?(mytv)|n)(?P<id>\d+)\.shtml.*?'

which would not match your original URL. When running from the command line, youtube-dl must resolve the URL before checking for a suitable extractor. This is probably something you will need to do manually before passing the URL to the module. Perhaps I could add a utility function to the module that will resolve URLs or add an optional resolve_url=True argument. I don't want to have this done automatically because it can sometimes be a slow task, and in most instances is not necessary.

ruuk commented 10 years ago

I added the argument resolve_redirects=False to getVideoInfo() and mightHaveVideo(). The addon module is updated as well.

Set it to True if you want the URL to be resolved first. I have not tested the redirection in the module, but I tested the redirect function and it works on the URL you had issues with.

ruuk commented 10 years ago

Let me know if this fixes your issue and if the module is otherwise working well for you and I'll submit it to the official XBMC repository.

hojel commented 10 years ago

I upgrade to 14.519.1 but the same error is still shown, like this:

03:54:02 T:18008 NOTICE: script.module.youtube.dl - _getYoutubeDLVideo() failed::getVideoInfo (417) - ERROR: no suitable InfoExtractor for URL http://my.tv.sohu.com/u/vw/69124875

On Wed, May 21, 2014 at 6:16 PM, ruuk notifications@github.com wrote:

Let me know if this fixes your issue and if the module is otherwise working well for you and I'll submit it to the official XBMC repository.

— Reply to this email directly or view it on GitHubhttps://github.com/ruuk/script.module.youtube.dl/issues/2#issuecomment-43837758 .

ruuk commented 10 years ago

I added the argument resolve_redirects=False to getVideoInfo() and mightHaveVideo().

Did you use this new argument? Setting resolve_redirects=True will resolve the URL before sending it off to get an InfoExtractor.

hojel commented 10 years ago

I never considered the option. It works like charm with the option. Thanks

On Tue, May 27, 2014 at 5:02 PM, ruuk notifications@github.com wrote:

I added the argument resolve_redirects=False to getVideoInfo() and mightHaveVideo().

Did you use this new argument? Setting resolve_redirects=True will resolve the URL before sending it off to get an InfoExtractor.

— Reply to this email directly or view it on GitHubhttps://github.com/ruuk/script.module.youtube.dl/issues/2#issuecomment-44350820 .