Shared parsing of box.net files

Source: Internet
Author: User

. Net, in my opinion, the best file storage platform on the Internet
I have previously written about its shared folder address parsing, and I forgot why I wrote so much.
Let's look at a box.netFolderShared Link
Http://www.box.net/shared/9729z1fkh7
The address for parsing it is

Http://www.box.net/shared/9729z1fkh7/rss.xml

I just added "/RSS. XML "(from http://www.box.net/shared/9729z1fkh7source file), this address is recognized by most browsers-an RSS-formatted XML that parses it well, please try (Open http://www.box.net/shared/9729z1fkh7/rss.xml in Firefox, IE7 or opera)

Next, let's look at a box.netFileShared Link
Http://www.box.net/shared/7pfcocvzhd
Box.net itself only provides the independent file chain function to paying members. The above is a free user's file sharing link, which cannot be recognized by third-party download tools after being opened.

This article describes how to enable free Member files to be independent from external links (allowing download tools to play a role)
Some of you may think of this as simple: I put the files to be external links in the shared folder, and add a "/RSS" to the folder sharing link. XML "allows the browser to read the file and the link is obtained. It is not too silly, but it is a little tired. It is the most direct method without additional mental power.
After my tedious analysis, normal file sharing links in box.net can be converted into independent external link addresses. If you believe it or not, you will find out, I developed a parsing tool using Python using Google App Engine:
Http://tld.appspot.com/box_file
Put the file sharing link http://www.box.net/shared/7pfcocvzhd above and read it to get an address

Http://box.net/rssdownload/269058742/test.rar

If you compare this address with the file link address obtained in the shared folder, you will know what I am talking about.

It looks like it! By the way, I was wondering if their addresses would be generic, and the file links in shared folders would all be

Http://box.net/rssdownload/{a string of numbers; /#file name}

The link to a common file contains a string of numbers in the source file --File_idLet's take a look at what it looks like, and put together the file names. It's really good. Hi, box.net developers are too "benevolent" to orz.
My parsing tool is to read the source file of the shared link of the box.net file and find the file_id and file name.
Appendix: (box.net File Link web parsing, Python source code)

Import Urllib, CGI

DefSubstr (A, B, C, D ):
ReturnA [A. Index (C, A. Index (B ))+Len (c): A. Index (D, A. Index (B)]

Print   " Content-Type: text/html \ n "
Print   " <HTML> "
Print   " <B> enter a box.net File Link: </B> <br/> "
Print   " <Form action = ''> <input type = text name = URL size = 30> <input type = submit value = 'read'> </form> "
Print   " </Body> "

Form = CGI. fieldstorage ()
If Form. getvalue ( " URL " ):
F = Urllib. urlopen (Form [ ' URL ' ]. Value)
Data = ""
For I In F:
Data + = I
File_id = Substr (data, " VaR file_id " , " ' " , " '; " )
File_name = Substr (data, " VaR name " , " ' " , " '; " )
File_size = Substr (data, " Download " , " ( " , " ) " )
Download_url = " Http://box.net/rssdownload/ " + File_id + " / " + File_name

Print "<a href = '" + download_url + "'>" + file_name + "</a> <br/>"
Print "Size:" + file_size

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.