Subscribejavascript:d=document;w=window;t=';if(d.selection){t=d.selection.createRange().text}else%20if(d.getSelection){t=d.getSelection()}else%20if(w.getSelection){t=w.getSelection();}void(w.open('http://yourdomain.com/path/to/yourscript.php?&pagetitle='+escape(d.title)+'&url='+escape(d.location.href)+'"e='+escape(t),'_blank','status=yes,resizable=yes,scrollbars=yes'))<form method="post" class="myformclass" action="backendscript.php" name="bookmarklet_handler">
<table>
<td align="right"><label for="title_field" class="mylabelclass">Headline:</label></td>
<td><input class="mytextboxclass" id="title_field" name="pagetitle" size="48" value="<?=$_GET["pagetitle"]?>" /></td>
<textarea class="mytextareaclass" id="new_post_textarea" name="mainbody" style='width:800px;height:500px;'><?="<a href=\"" . $_GET["url"] . "\">" . $_GET["pagetitle"] . "</a>\n\n<blockquote>" . $_GET["quote"] . "</blockquote>"?></textarea>
</table>
</form>Loads source for passed urlYou can do all this in javascript with its regular expressions. Just figure out if the URL (d.location.href in the bookmarklet above) contains youtube, and if it does, use the DOM to locate the embed or object tag, if any, and set a variable to contain the (properly escaped) innerHTML property of the tag. Then you handle it in PHP as above.
Determines if its YouTube or Google Video
Parses page to find a specific set of tags
You are not logged in, either login or create an account to post comments
posted by evariste at 9:29 AM on March 8, 2006