Hi there,
I'm trying to determine the best, most vague way to collect URL addresses for different social video sites ie. YouTube, DailyMotion etc. I realised that I don't really have to do any parsing if I just ask users to submit embed values. Then again I don't really like this solution and would much prefer parsing the embed HTML code.
Here is a sample video from YouTube recently:
What I'm thinking would work best is if I regex'ed the src tag and stored just the link in my db (instead of the entire embed code). This will allow me to create my own embed features options, resize the window etc.
That issue is however that while I can do this easily with regex I'd have to write functions specific to most sites. It's then just a matter of creating the regex. Here is my first stab at it:
src="(.)+"
I'm not at all good at regex (not much experience). My idea was to simply parse the src and take the full value, place in db then detect which embed code it is.
I'm wondering if someone has suggestions on moving ahead with this ie. perhaps just going with storing the current embed code - though there are mostly a lot of negative reasons for doing that.
Help is greatly appreciated.
Dave
I'm trying to determine the best, most vague way to collect URL addresses for different social video sites ie. YouTube, DailyMotion etc. I realised that I don't really have to do any parsing if I just ask users to submit embed values. Then again I don't really like this solution and would much prefer parsing the embed HTML code.
Here is a sample video from YouTube recently:
Code:
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/SXEGEfDSTZ4&hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/SXEGEfDSTZ4&hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>That issue is however that while I can do this easily with regex I'd have to write functions specific to most sites. It's then just a matter of creating the regex. Here is my first stab at it:
src="(.)+"
I'm not at all good at regex (not much experience). My idea was to simply parse the src and take the full value, place in db then detect which embed code it is.
I'm wondering if someone has suggestions on moving ahead with this ie. perhaps just going with storing the current embed code - though there are mostly a lot of negative reasons for doing that.
Help is greatly appreciated.
Dave
>> read the main forum post




Add Your Comment
Follow-up comment rss or Leave a TrackbackLeave A Reply