<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Smörgåsbord &#187; OmroepStreamDump</title>
	<atom:link href="http://smorgasbord.gavagai.nl/topics/tech/omroepstreamdump/feed/" rel="self" type="application/rss+xml" />
	<link>http://smorgasbord.gavagai.nl</link>
	<description>Ambachtelijk bereide beschouwingen.</description>
	<lastBuildDate>Fri, 06 Jan 2012 21:30:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>OmroepStreamDump</title>
		<link>http://smorgasbord.gavagai.nl/2009/04/omroepstreamdump-001/</link>
		<comments>http://smorgasbord.gavagai.nl/2009/04/omroepstreamdump-001/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 21:28:18 +0000</pubDate>
		<dc:creator>Wicher</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[OmroepStreamDump]]></category>

		<guid isPermaLink="false">http://smorgasbord.gavagai.nl/?p=359</guid>
		<description><![CDATA[[Update @20090607: De code moet regelmatig bijgewerkt worden om veranderingen op player.omroep.nl te reflecteren. De laatste versie kun je altijd downloaden van de officiële pagina, daar kun je ook pingen (via een issue) als het script aangepast moet worden aan een nieuwe versie van player.omroep.nl (m.a.w., als het niet meer werkt).]
Ik heb een Greasemonkey-scriptje geschreven [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:x-small; color:orange;">[Update @20090607: De code moet regelmatig bijgewerkt worden om veranderingen op player.omroep.nl te reflecteren. De laatste versie kun je altijd downloaden van <a href="http://userscripts.org/scripts/show/47693">de officiële pagina</a>, daar kun je ook pingen (via een issue) als het script aangepast moet worden aan een nieuwe versie van player.omroep.nl (m.a.w., als het niet meer werkt).]</span></p>
<p>Ik heb een <a href="https://addons.mozilla.org/en-US/firefox/addon/748">Greasemonkey</a>-scriptje geschreven dat op player.omroep.nl een dialoogje geeft waarvan je de inhoud direct in een shell (Bash-shell, wellicht ook de standaard Bourne-shell) kan pasten. Je krijgt iets dergelijks voorgeschoteld:<br />
<code><br />
export TIEFDIR="${PWD}"; export TEMPDIR=$(mktemp -d); cd ${TEMPDIR} &#038;&#038; mplayer -dumpstream -user-agent 'Windows-Media-Player/11.0.6001.7000' 'http://cgi.omroep.nl/legacy/player?/ceres/vara/rest/2009/VARA_101192917/bb.20090424.asf' &#038;&#038; mv stream.dump ${TIEFDIR}/'De Wereld Draait Door - 25-04-2009.wmv' &#038;&#038; cd - &#038;&#038; rmdir ${TEMPDIR}<br />
</code><br />
Dat maakt het downloaden van videomateriaal van uitzendinggemist.nl een stukje makkelijker. Natuurlijk moet je wel Firefox + Greasemonkey-extensie, een shell en MPlayer hebben, maar wie heeft dat nou niet ;-)<br />
<a href="http://userscripts.org/scripts/review/47693">Hier kun je de source lezen</a> en als je <a href="https://addons.mozilla.org/en-US/firefox/addon/748">Greasemonkey</a> hebt geïnstalleerd kun je <a href="http://userscripts.org/scripts/show/47693">hier op &#8220;Install&#8221; klikken</a>.<br />
Surf vervolgens naar <a href="http://www.uitzendinggemist.nl/">uitzendinggemist.nl</a> en fair-use er op los.<br />
En hier natuurlijk het leukste stuk van de source. Ik schrijf haast nooit Javascript dus opmerkingen/aanvullingen zijn zeer welkom.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> playert <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;player&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// Listener for node insertions (generated by omroep.nl's javascript)</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>playert<span style="color: #009900;">&#41;</span> playert.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;DOMNodeInserted&quot;</span><span style="color: #339933;">,</span> genAlert<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> genAlert<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> playert <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;player&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> embedelement <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'MediaPlayer'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>embedelement<span style="color: #009900;">&#41;</span>
  <span style="color: #006600; font-style: italic;">//The embed element got inserted - now we have all required parameters for dumping</span>
    <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> pastetext<span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> source <span style="color: #339933;">=</span> embedelement.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;src&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;'&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//These URL's shouldn't have &quot;'&quot; in them but we escape them just to be sure.</span>
    <span style="color: #006600; font-style: italic;">//Create a copy of the title &amp; date info so we can use DOM functions to separate the two</span>
    <span style="color: #003366; font-weight: bold;">var</span> worktitle <span style="color: #339933;">=</span> document.<span style="color: #660066;">importNode</span><span style="color: #009900;">&#40;</span>playert.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;h3&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> worktitledatespan <span style="color: #339933;">=</span> worktitle.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;span&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> datum <span style="color: #339933;">=</span> worktitledatespan.<span style="color: #660066;">innerHTML</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;'&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Escape ' to make shell-safe</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>datum<span style="color: #009900;">&#41;</span> datum <span style="color: #339933;">=</span> <span style="color: #3366CC;">'nodate'</span><span style="color: #339933;">;</span>
    worktitle.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>worktitledatespan<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> titel <span style="color: #339933;">=</span> worktitle.<span style="color: #660066;">innerHTML</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;'&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Escape ' to make shell-safe</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>titel <span style="color: #339933;">&amp;&amp;</span> source<span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#123;</span>
      playert.<span style="color: #660066;">removeEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;DOMNodeInserted&quot;</span><span style="color: #339933;">,</span> genAlert<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      pastetext <span style="color: #339933;">=</span> <span style="color: #3366CC;">'export TIEFDIR=&quot;${PWD}&quot;; export TEMPDIR=$(mktemp -d); cd ${TEMPDIR} &amp;&amp; '</span>
      pastetext<span style="color: #339933;">+=</span> <span style="color: #3366CC;">&quot;mplayer -dumpstream -user-agent 'Windows-Media-Player/11.0.6001.7000' '&quot;</span><span style="color: #339933;">+</span>source<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;' &amp;&amp; &quot;</span><span style="color: #339933;">;</span>
      pastetext<span style="color: #339933;">+=</span> <span style="color: #3366CC;">'mv stream.dump ${TIEFDIR}/<span style="color: #000099; font-weight: bold;">\'</span>'</span><span style="color: #339933;">+</span>titel<span style="color: #339933;">+</span><span style="color: #3366CC;">' - '</span><span style="color: #339933;">+</span>datum<span style="color: #339933;">+</span><span style="color: #3366CC;">'.wmv<span style="color: #000099; font-weight: bold;">\'</span> &amp;&amp; cd - &amp;&amp; rmdir ${TEMPDIR}'</span><span style="color: #339933;">;</span>
      <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>pastetext<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://smorgasbord.gavagai.nl/2009/04/omroepstreamdump-001/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://cgi.omroep.nl/legacy/player?/ceres/vara/rest/2009/VARA_101192917/bb.20090424.asf" length="168" type="video/x-ms-wmv" />
		</item>
	</channel>
</rss>

