Commit 6817842b authored by Antoine Cellerier's avatar Antoine Cellerier

videoportals.c: Add support for Daily Motion URLs (the webpage's url).

parent 7e0be9b2
......@@ -27,6 +27,7 @@
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc_demux.h>
#include <vlc_url.h>
#include <errno.h> /* ENOMEM */
#include "playlist.h"
......@@ -52,6 +53,9 @@ int E_(Import_VideoPortal)( vlc_object_t *p_this )
char *psz_cur;
char *psz_url = NULL;
byte_t *p_peek;
int i_peek;
/* YouTube */
if( ( psz_cur = strstr( psz_path, "youtube.com" ) ) )
{
......@@ -88,6 +92,31 @@ int E_(Import_VideoPortal)( vlc_object_t *p_this )
}
}
}
/* Daily motion */
else if( ( psz_cur = strstr( psz_path, "dailymotion.com" ) ) )
{
i_peek = stream_Peek( p_demux->s, &p_peek, strlen( "<!DOCTYPE" ) );
if( !strncmp( (char*)p_peek, "<!DOCTYPE", strlen( "!<DOCTYPE" ) ) )
{
/* This looks like a (daily motion) webpage */
char *psz_line;
while( ( psz_line = stream_ReadLine( p_demux->s ) ) )
{
if( ( psz_cur = strstr( psz_line,
"param name=\"flashvars\" value=\"url=" ) ) )
{
char *psz_tmp;
psz_cur += strlen( "param name=\"flashvars\" value=\"url=" );
psz_tmp = strchr( psz_cur, '&' );
*psz_tmp = 0;
psz_url = strdup( psz_cur );
decode_URI( psz_url );
*psz_tmp = '&';
break;
}
}
}
}
if( !psz_url )
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment