ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.45k stars 10.04k forks source link

Fails on Dailymotion #281

Closed baskerville closed 12 years ago

baskerville commented 12 years ago
youtube-dl 'http://www.dailymotion.com/video/x6wzpl_50-ans-de-l-ihes-marc-chemillier_tech'

Fails with the following message:

ERROR: unable to extract title
phihag commented 12 years ago

Which youtube-dl version are you using? This works fine for me (from Germany) with youtube-dl 2012.02.26.

baskerville commented 12 years ago

You're right: it works with the latest Git version.

5moufl commented 12 years ago

with the latest git version: WARNING: unable to extract uploader nickname

FiloSottile commented 12 years ago

Please be sure to use the really latest, I think I fixed this a couple of days ago in fe4d68e. Please reopen if you still suffer this issue anyway.

5moufl commented 12 years ago

I just pulled the really latest and:

$ youtube-dl "http://www.dailymotion.com/video/xupj7x_interview-one-word-d-antoine-saout_sport"
[dailymotion] xupj7x: Downloading webpage
[dailymotion] xupj7x: Extracting information
[dailymotion] Using hd720URL
WARNING: unable to extract uploader nickname
FiloSottile commented 12 years ago

Ah, got it, you have to make youtube-dl to update the binary, or use python -m youtube_dl as the binary gets the new patches only on releases. Sorry not to have intuited that before... I should push a FAQ.

5moufl commented 12 years ago

All good.

yvestan commented 12 years ago

Hi,

I've always this bug with the last git revision ?!

This video is OK to download : "http://www.dailymotion.com/video/xupj7x_interview-one-word-d-antoine-saout_sport"

This other not : "http://www.dailymotion.com/video/xbj1fg_stargate-studios-reel_shortfilms"

yvestan commented 12 years ago

I thinks It's because regexp (line 695) match only "normal" Dailymotion user like :

 <span class="owner foreground2">Par    <a class="name" rel="author" title="aller sur la page profil de madeinpoker" href="/madeinpoker">madeinpoker</a></span>

(match "madeinpoker")

But Dailymotion "official user" can use logo instead of simple link :

<span rel="author" class="name owner_link linkable" data-href="/FilmGeek-TV">FilmGeek-TV</span>

(match "FilmGeek-TV")

It's should to test this two possibility

I've tested with PHP

$owner = preg_match('#<span rel="author".*>(.*)</span>#', $f, $match);  

Can you help me to add this in Python ;) ?

(sorry for my bad english)

yvestan commented 12 years ago

Works fine with this :

diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index a5c8b91..fd42f24 100644
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -694,7 +694,12 @@ class DailymotionIE(InfoExtractor):
                video_uploader = u'NA'
                mobj = re.search(r'(?im)<span class="owner[^\"]+?">[^<]+?<a [^>]+?>([^<]+?)</a>', webpage)
                if mobj is None:
-                       self._downloader.trouble(u'WARNING: unable to extract uploader nickname')
+                       # lookin for official user
+                       mobj_official = re.search(r'<span rel="author".*>([a-zA-Z0-9\-]*)</span>', webpage)
+                       if mobj_official is None:
+                               self._downloader.trouble(u'WARNING: unable to extract uploader nickname')
+                       else:
+                               video_uploader = mobj_official.group(1)
                else:
                        video_uploader = mobj.group(1)

May be not a multiline regexp ?

I propose a pull request ?

FiloSottile commented 12 years ago

LGTM, applying, thanks!