<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://townx.org" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>townx - BBC iPlayer Ruby code - Comments</title>
 <link>http://townx.org/blog/elliot/iplayer-ruby-code</link>
 <description>Comments for &quot;BBC iPlayer Ruby code&quot;</description>
 <language>en</language>
<item>
 <title>I&#039;ve updated this recently:</title>
 <link>http://townx.org/blog/elliot/iplayer-ruby-code#comment-38128</link>
 <description>&lt;p&gt;I&#039;ve updated this recently: see &lt;a href=&quot;http://townx.org/blog/elliot/ruby-tuesday-miplayer-some-iplayer-ruby-shizz-linux&quot;&gt;this blog entry instead&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It&#039;s a script which you run from the command line, which presents itself as a web site. Behind the scenes, using the web site makes calls to the iPlayer site in the background. The other alternative is to run it as a scheduled task (Windows) or cron job (Linux), where the script will perform your searches and email the results.&lt;/p&gt;

&lt;p&gt;It&#039;s not really intended for non-technical users, so if you&#039;re not a command line user, you may find it tricky to get started with.&lt;/p&gt;</description>
 <pubDate>Tue, 06 May 2008 14:18:40 -0500</pubDate>
 <dc:creator>elliot</dc:creator>
 <guid isPermaLink="false">comment 38128 at http://townx.org</guid>
</item>
<item>
 <title>The iPlayer</title>
 <link>http://townx.org/blog/elliot/iplayer-ruby-code#comment-38127</link>
 <description>&lt;p&gt;I&#039;m not too clued up with scripting.  So, is this an external script that you run when the search page is open, or does the script somehow tap into the iplayer search page?&lt;/p&gt;

&lt;p&gt;Andy&lt;/p&gt;</description>
 <pubDate>Tue, 06 May 2008 03:46:28 -0500</pubDate>
 <dc:creator>Andy from PC to TV senders</dc:creator>
 <guid isPermaLink="false">comment 38127 at http://townx.org</guid>
</item>
<item>
 <title>UK Proxy</title>
 <link>http://townx.org/blog/elliot/iplayer-ruby-code#comment-15132</link>
 <description>&lt;p&gt;someone got a list of uk proxies available?&lt;/p&gt;</description>
 <pubDate>Sun, 13 Jan 2008 07:33:39 -0600</pubDate>
 <dc:creator>Jimmy</dc:creator>
 <guid isPermaLink="false">comment 15132 at http://townx.org</guid>
</item>
<item>
 <title>Ah, sorry Fred. Though if</title>
 <link>http://townx.org/blog/elliot/iplayer-ruby-code#comment-15113</link>
 <description>&lt;p&gt;Ah, sorry Fred. Though if you could get a UK proxy you might be able to pretend you&#039;re over here...&lt;/p&gt;</description>
 <pubDate>Sat, 12 Jan 2008 10:52:16 -0600</pubDate>
 <dc:creator>elliot</dc:creator>
 <guid isPermaLink="false">comment 15113 at http://townx.org</guid>
</item>
<item>
 <title>only in UK</title>
 <link>http://townx.org/blog/elliot/iplayer-ruby-code#comment-15105</link>
 <description>&lt;p&gt;if you are not in &lt;span class=&quot;caps&quot;&gt;UK, &lt;/span&gt;it won&#039;t work...&lt;br /&gt;
bbc only let you download if you&#039;re in &lt;span class=&quot;caps&quot;&gt;UK.&lt;/span&gt;&lt;br /&gt;
what a bullshit....&lt;/p&gt;</description>
 <pubDate>Sat, 12 Jan 2008 01:27:35 -0600</pubDate>
 <dc:creator>fred</dc:creator>
 <guid isPermaLink="false">comment 15105 at http://townx.org</guid>
</item>
<item>
 <title>BBC iPlayer Ruby code</title>
 <link>http://townx.org/blog/elliot/iplayer-ruby-code</link>
 <description>&lt;p&gt;I threw together some code for querying and parsing the &lt;a href=&quot;http://bbc.co.uk/iplayer&quot;&gt;&lt;span class=&quot;caps&quot;&gt;BBC &lt;/span&gt;iPlayer&lt;/a&gt; search pages and emailing the results to you. You configure it by putting the names of the programmes you want to look out for into &lt;tt&gt;config.yaml&lt;/tt&gt;, along with your email details, e.g.&lt;/p&gt;



&lt;pre&gt;
search_terms:
  - mighty boosh
  - lead balloon
  - never better

email:
  email_to: &lt;a href=&quot;mailto:email@example.com&quot;&gt;email@example.com&lt;/a&gt;
  email_from: &lt;a href=&quot;mailto:email@example.com&quot;&gt;email@example.com&lt;/a&gt;
  server: mail.example.com
  user: &lt;a href=&quot;mailto:email@example.com&quot;&gt;email@example.com&lt;/a&gt;
  pass: password
  auth_type: login
&lt;/pre&gt;



&lt;p&gt;Copy the sample &lt;tt&gt;config.yaml.dist&lt;/tt&gt; to &lt;tt&gt;config.yaml&lt;/tt&gt; in the same directory and edit.&lt;/p&gt;

&lt;p&gt;I run the command line script via cron once a day by calling the &lt;tt&gt;cli.rb&lt;/tt&gt; script with an &lt;tt&gt;--email&lt;/tt&gt; switch, e.g. with the following line in crontab:&lt;/p&gt;



&lt;pre&gt;
0 21 * * * /usr/bin/ruby /home/ell/dev/iplayer/cli.rb --email
&lt;/pre&gt;



&lt;p&gt;You could as easily run it from a Windows scheduled task.&lt;/p&gt;

&lt;p&gt;Dependencies are:&lt;/p&gt;


&lt;ul&gt;
&lt;li&gt;hpricot&lt;/li&gt;
&lt;li&gt;rack&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;What it does is request the iPlayer search page with each search term, one after the other. If there are multiple pages of results, it fetches each of those too, aggregating the results. It will then email you a list of links to the programmes on the iPlayer site. One thing it does which the iPlayer search page doesn&#039;t do is sort the matching results by how long is left for you to watch them: the ones with the least amount of time left are at the top.&lt;/p&gt;

&lt;p&gt;You can also run it as a local web server on port 3334 with:&lt;/p&gt;



&lt;pre&gt;
ruby server.rb
&lt;/pre&gt;



&lt;p&gt;Which then becomes accessible at:&lt;/p&gt;



&lt;pre&gt;
&lt;a href=&quot;http://localhost:3334/&quot; title=&quot;http://localhost:3334/&quot;&gt;http://localhost:3334/&lt;/a&gt;
&lt;/pre&gt;



&lt;p&gt;Nothing fancy: just an &lt;span class=&quot;caps&quot;&gt;HTML &lt;/span&gt;page with the search results in it, using the same config. as the command-line client. You can also call the page with extra search parameters to perform custom one-off searches, e.g.&lt;/p&gt;



&lt;pre&gt;
&lt;a href=&quot;http://localhost:3334/?search=doctor+who&quot; title=&quot;http://localhost:3334/?search=doctor+who&quot;&gt;http://localhost:3334/?search=doctor+who&lt;/a&gt;
&lt;/pre&gt;



&lt;p&gt;It&#039;s not a serious project, just a convenience for me. &lt;span class=&quot;caps&quot;&gt;GPL &lt;/span&gt;licence.&lt;/p&gt;</description>
 <comments>http://townx.org/blog/elliot/iplayer-ruby-code#comments</comments>
 <category domain="http://townx.org/tech">tech</category>
 <category domain="http://townx.org/code">code</category>
 <enclosure url="http://townx.org/files/iplayer.zip" length="5204" type="application/zip" />
 <pubDate>Fri, 11 Jan 2008 16:16:29 -0600</pubDate>
 <dc:creator>elliot</dc:creator>
 <guid isPermaLink="false">695 at http://townx.org</guid>
</item>
</channel>
</rss>
