Back to Home

Magnet Internet 2 - Hypertext

magnet links · p2p · freedom · shareaza · rhash · base64 · internet on magnets

Magnet Internet 2 - Hypertext

    It's time to unleash the hypertext and expand the possibilities of its distribution not only in the classic client-server way, but also in peer-to-peer networks. In order for it to be fully understood by small efforts, the webmaster will have to try. To do this, you need the resources necessary for the correct display to pack in HTML. If everything is clear with scripts and styles, their text can be inserted with the contents of the corresponding script and style tags, preliminary processing is already necessary for images.



    Image processing


    The image must be saved in JPEG with progressive mode turned on, and the compression level must be adjusted so that the image looks good not only when it is fully loaded, but also quite acceptable in the cropped version for IE (Limit of 32768 characters in the data url). For this, I, for example, used IrfanView. When saving the image, put a checkmark in progressive mode (Save as progressive JPG). Additionally, I put a daw on "Try to save with original JPG quality." He took the rest off: we don’t need extra data in the file.


    We will use Data Url


    Now we encode the received image in base64. The MIME Tools plugin for notepad ++ does a great job of this.


    1. Open image file in Notepad ++
    2. Edit -> Select All
    3. MIME Tools -> Base64 encode
    4. Append to the result at the beginning of "data: image / jpeg; base64,"
    5. Copy and paste in the HTML document


    Other image formats should be tried to fit into the framework of IE, that is, 21830 bytes in the case of using base64. Also, do not forget to change the mime type image / jpeg to the appropriate file type.


    Hypertext and External Resource File Name


    Requirements:


    1. The uniqueness of the name - The file name must be chosen taking into account the fact that the file can appear in one directory with many others. To do this, you can add the creation time or crc file to the name.
    2. Your unique prefix - it is advisable to start the file name with the name of the author (or another key that you will use for all the pages created). Thus, it will be convenient to group files by author.

    03.04.2012  13:04           947 346 archimeta-ru-kryg-2012-04-03-13-04.mp4
    03.04.2012  13:05         1 792 810 archimeta-ru-kryg-2012-04-03-13-04.ogv
    03.04.2012  13:05         1 107 873 archimeta-ru-kryg-2012-04-03-13-04.webm
    03.04.2012  14:28           243 432 ivan386-p2p-html-2012-04-03-13-04.html
    

    External resources


    Unfortunately, not everything can be packed into one file. Significant html sizes may cause browser performance issues. So the video and audio podcasts will have to be kept (and downloaded accordingly) separately. Moreover, for full compatibility, 3 types of video and 3 types of audio are required (of course, you can also wav optionally).


    We have all the necessary versions of video and audio, run them through rhash and get a combined magnet for each.


    For example, I wrote a cmd file like this:


    %~d0
    cd %~p0
    rhash --torrent -p "%%f#magnet:?xt=urn:ed2k:%%e&xl=%%s&dn=%%u&xt=urn:tree:tiger:%%t&xt=urn:btih:%%{btih}" %1 %2 %3 %4 %5 %6 %7 %8 %9 | clip
    		

    The combined magnet is directly to the clipboard and a torrent file is nearby. True clip with whists appeared, therefore, to the good old HP you need a separate utility. Well, or the good old way:


    rhash --torrent -p "%%f#magnet:?xt=urn:ed2k:%%e&xl=%%s&dn=%%u&xt=urn:tree:tiger:%%t&xt=urn:btih:%%{btih}" %1 %2 %3 %4 %5 %6 %7 %8 %9 > temp.txt
    notepad temp.txt
    		

    archimeta-ru-kryg-2012-04-03-13-04.mp4#magnet:?xt=urn:ed2k:e803fe1127ad3cd20bc335bbd17c6c8b&xl=947346&dn=archimeta-ru-kryg-2012-04-03-13-04.mp4&xt=urn:tree:tiger:tm6z5ohogst2qsmbq2awl7dz4niz2dokzawz5jq&xt=urn:btih:884162be8064f3bf10e524a0b03fc0e3e796c56f
    

    Also Shareaza can make magnets according to the template (if the file is already shared it will not need to be processed a second time).


    It would be possible to separately give a magnet to a file, but it is better to separate them with a script. So the magnet is firmly attached to the resource, and it is clear that this is one file. This will further automate the boot process. In the magnet, you can also specify a direct link to the file on the server (see. Web link to the file (as, xs) ).


    Most likely, opening the video page for the first time, the video file itself will not yet lie on the disk, and it will only have to be downloaded. Therefore, in the preload property of the video tag, set none, and in the poster property, insert the data url with a frame from the video or any other content to fill in the empty space.


    Well, actually, in the source tags we write our combined magnets in the order mp4, webm, ogv.



    When our p2p web page is ready, in the same way we make a combined magnet on it and publish it. Naturally, if you publish it on an external resource, then it makes sense to use only a magnet.


    Do not forget that in order to be able to get your page and resources, it must be shared in p2p networks. At the moment, the Shareaza client is well suited for this . supports multiple networks.


    Well, now, I think it's time to finish the second part of the article, otherwise I already kept it on my disk for so long.


    This article with examples of

    Internet on magnets 1 - Magnet
    Internet on magnets 2 - Hypertext
    Internet on magnets 3 - P2P Website and
    Internet on magnets 4 - Divide the magnet into parts of the
    Internet on magnets 5 - Beacons and messages (personal, public and updates)

    Read Next