<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<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>bit torrent &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/bit-torrent/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Wed, 13 Nov 2024 07:54:44 +0000</lastBuildDate>
	<language>en-GB</language>
	<copyright>© Terence Eden. 🄯 CC BY-SA. See https://shkspr.mobi/blog/copyright-and-copyleft/</copyright>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.3</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>bit torrent &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Mobile Bit Torrent]]></title>
		<link>https://shkspr.mobi/blog/2011/11/mobile-bit-torrent/</link>
					<comments>https://shkspr.mobi/blog/2011/11/mobile-bit-torrent/#comments</comments>
				<dc:creator><![CDATA[Terence Eden]]></dc:creator>
		<pubDate>Sun, 13 Nov 2011 17:15:40 +0000</pubDate>
		<category><![CDATA[bit torrent]]></category><category><![CDATA[bittorrent]]></category><category><![CDATA[jquery]]></category><category><![CDATA[jquery mobile]]></category><category><![CDATA[mobile]]></category><category><![CDATA[NaBloPoMo]]></category><category><![CDATA[torrent]]></category>		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=4579</guid>

					<description><![CDATA[This is a project I developed for OTA11 - but didn&#039;t feel confident showing it off.  Not least because I was one of the competition judges!  Preamble       Many people download BitTorrent files.     There are no BitTorrent search engines which are mobile friendly.     Users have to try to navigate non-mobile-optimised websites.     This is slow, inefficient, and may cost the user money in…]]></description>
										<content:encoded>&lt;p&gt;This is a project I developed for &lt;a href="https://web.archive.org/web/20111012045423/http://overtheair.org/blog/2011/09/29/ota11-hackday-categories-prizes/"&gt;OTA11&lt;/a&gt; - but didn't feel confident showing it off.  Not least because I was one of the competition judges!&lt;/p&gt;

&lt;h2 id="preamble"&gt;&lt;a href="https://shkspr.mobi/blog/2011/11/mobile-bit-torrent/#preamble"&gt;Preamble&lt;/a&gt;&lt;/h2&gt;

&lt;ul&gt;
    &lt;li&gt;Many people download BitTorrent files.&lt;/li&gt;
    &lt;li&gt;There are no BitTorrent search engines which are mobile friendly.&lt;/li&gt;
    &lt;li&gt;Users have to try to navigate non-mobile-optimised websites.&lt;/li&gt;
    &lt;li&gt;This is slow, inefficient, and may cost the user money in bandwidth charges.&lt;/li&gt;
    &lt;li&gt;People who run Bit Torrent sites are often sued.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id="the-problem"&gt;&lt;a href="https://shkspr.mobi/blog/2011/11/mobile-bit-torrent/#the-problem"&gt;The Problem&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;BitTorrent search engines have a nasty habit of being sued (not something I want to happen to me!)&lt;/p&gt;

&lt;p&gt;Lawsuits arrive based, usually, on one of the following factors:&lt;/p&gt;

&lt;ul&gt;
    &lt;li&gt;The site is hosting material which infringes a complainant's copyright.&lt;/li&gt;
    &lt;li&gt;The site operates a tracker which tells users how to access copyrighted material without permission.&lt;/li&gt;
    &lt;li&gt;The site distributes .torrent files which tell users how to access trackers.&lt;/li&gt;
    &lt;li&gt;The site operates a search engine for Bit Torrent files.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id="the-challenge"&gt;&lt;a href="https://shkspr.mobi/blog/2011/11/mobile-bit-torrent/#the-challenge"&gt;The Challenge&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Is it possible to create a mobile friendly torrent search engine which neither hosts, distributes, nor searches for .torrent files?&lt;/p&gt;

&lt;p&gt;This is how the usual client / server relationship works&lt;/p&gt;

&lt;pre&gt;     +------------+           +------------+          +------------+
     |Browser     |           |Site        |          |Server      |
     +-----+------+           +------+-----+          +------------+
           |                         |                      +
           | Request for HTML page   |                      |
           +------------------------&amp;gt;|                      |
           |                         |Search Request        |
           |                         +---------------------&amp;gt;|
           |                         |                      |
           |                         |                      |
           |                         |  Search Response     |
           | Generated page sent     |&amp;lt;--------------------+|
           |&amp;lt;-----------------------+|                      |
&lt;/pre&gt;

&lt;p&gt;The browser asks the torrent site, the torrent site asks a search engine, the search engine responds to the site, and the site returns a page to the user's browser.&lt;/p&gt;

&lt;p&gt;This opens the site owner up to all sorts of risks.  She knows what her users are searching for and she knows what response the torrent provider is sending.&lt;/p&gt;

&lt;p&gt;Is there a way around this?  Well, using &lt;a href="http://jquerymobile.com/"&gt;jQuery Mobile&lt;/a&gt;, I believe there is.&lt;/p&gt;

&lt;pre&gt;     +------------+           +------------+          +------------+
     |Browser     |           |Site        |          |Server      |
     +-----+------+           +------+-----+          +-----+------+
           |                         |                      |
           | Request for HTML page   |                      |
           +------------------------&amp;gt;|                      |
           |                         |                      |
           |                         |                      |
           | Generated page sent     |                      |
           |&amp;lt;------------------------+                      |
           |                                                |
           |                                                |
           | Search request direct to search engine         |
           +-----------------------------------------------&amp;gt;|
           |                                                |
           |                                                |
           |      Response sent directly to phone browser   |
           |&amp;lt;-----------------------------------------------+&lt;/pre&gt;

&lt;p&gt;Here's what happens:&lt;/p&gt;

&lt;ol&gt;
    &lt;li&gt;The user's mobile browser requests the search page.&lt;/li&gt;
    &lt;li&gt;The site delivers the search page to the browser.&lt;/li&gt;
    &lt;li&gt;User types "Ubuntu" into the search box and hits "search".&lt;/li&gt;
    &lt;li&gt;The text "Ubuntu" is &lt;strong&gt;not sent to the site&lt;/strong&gt;!&lt;/li&gt;
    &lt;li&gt;jQuery Mobile "intercepts" the request.&lt;/li&gt;
    &lt;li&gt;The browser sends the search query directly to the search server.&lt;/li&gt;
    &lt;li&gt;The browser downloads the search results directly. (JSONP)&lt;/li&gt;
    &lt;li&gt;The JavaScript on the browser renders the results on the screen.&lt;/li&gt;
    &lt;li&gt;The user downloads the torrent directly from the source.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So, in this way, all the service does is send some HTML and JavaScript to the user's phone.&lt;/p&gt;

&lt;p&gt;The majority of the logic is &lt;a href="http://jquerymobile.com/download/"&gt;stored on the jQuery CDN&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It is the user's phone which then communicates with the search engine. The user's phone which receives the results. And the user's phone which renders them.&lt;/p&gt;

&lt;p&gt;In this case, the server doesn't see any content - legal or otherwise - nor does it see any search requests.&lt;/p&gt;

&lt;h2 id="technical"&gt;&lt;a href="https://shkspr.mobi/blog/2011/11/mobile-bit-torrent/#technical"&gt;Technical&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;The code itself is fairly simple.&lt;/p&gt;

&lt;p&gt;There are no reliable Bit Torrent search APIs which respond via JSONP.  However, &lt;a href="https://web.archive.org/web/20111103004550/http://pipes.yahoo.com/pipes/search?r=tag%3Atorrent"&gt;Yahoo Pipes provides several "recipes"&lt;/a&gt; which query APIs and return correctly formatted data.&lt;/p&gt;

&lt;p&gt;Here's the skeleton code:&lt;/p&gt;

&lt;pre lang="javascript"&gt;var pipeURL = "http://pipes.yahoo.com/pipes/pipe.run?u="+
    searchTerm+
    "%26rows=10"+
    "%26sort="+
    sortBy+
    "&amp;amp;_render=json&amp;amp;_callback=?";

//  Get the JSONP and parse it
$.getJSON(pipeURL,
function(data)
{
    // An Array of list items to be added to the ul
    var listItems = [];
    //  Loop through the results
    $.each(data.value.items[0].items.list, function(i,item)
    {
        //  Get all the properties of each result
        var enclosure_url = item.enclosure_url;
        var title = item.title.replace(/(&amp;lt; ([^&amp;gt;]+)&amp;gt;)/ig,""); // Strip tags

        //  Create a set of &lt;li&gt;&lt;/li&gt; which can be added to the &lt;ul&gt;&lt;/ul&gt;
        listItems.push('&lt;li&gt;'+title+'&lt;/li&gt;');
    });
});
&lt;/pre&gt;

&lt;p&gt;To reiterate, all of this runs on the mobile phone.  There is nothing happening on my server.&lt;/p&gt;

&lt;p&gt;Now, I'm not sure that this is a cast iron legal defence - hence &lt;strong&gt;I am not making the site public&lt;/strong&gt; - but it moves the action squarely on to the user.&lt;/p&gt;

&lt;p&gt;In this case, the phone contacts Yahoo, Yahoo then contacts a Torrent search engine, the phone does all the sending, receiving, rendering, and downloading.  The server doesn't even see the search request.&lt;/p&gt;

&lt;h2 id="what-does-it-look-like"&gt;&lt;a href="https://shkspr.mobi/blog/2011/11/mobile-bit-torrent/#what-does-it-look-like"&gt;What Does It Look Like?&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;The initial page.
&lt;img src="https://shkspr.mobi/blog/wp-content/uploads/2011/11/xmts-start.png" alt="" title="xmts start" width="320" height="285" class="aligncenter size-full wp-image-4656"&gt;&lt;/p&gt;

&lt;p&gt;Searching
&lt;img src="https://shkspr.mobi/blog/wp-content/uploads/2011/11/xmts-search.png" alt="" title="xmts search" width="320" height="284" class="aligncenter size-full wp-image-4657"&gt;&lt;/p&gt;

&lt;p&gt;The results.
&lt;img src="https://shkspr.mobi/blog/wp-content/uploads/2011/11/xmts-results.png" alt="" title="xmts results" width="320" height="497" class="aligncenter size-full wp-image-4658"&gt;&lt;/p&gt;

&lt;p&gt;The user is then free to download the torrent.  Of course, the only torrent client I know for mobile phones is &lt;a href="https://web.archive.org/web/20111118030451/http://amorg.aut.bme.hu/projects/symtorrent"&gt;SymTorrent&lt;/a&gt; - and that only runs on older Symbian phones.  So this project is of no practical purpose.&lt;/p&gt;
&lt;img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=4579&amp;amp;HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager"&gt;</content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2011/11/mobile-bit-torrent/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
