[Turn] NBB Forum BT File Information Acquisition Implementation Method

xiaoxiao2021-03-06  317

The principle is to use the collection system of a BT release station, retrieve file information through the Hash code of the file and save the server local XML file, and then in addition to re-acquire the XML file as data source. Because the retrieval system of this BT release station is Slow during the day, so you can't get information in real time, which will cause the page to open the speed slowness.

VB / VB.NET code

Query Torrent File Information </ Title> <style type = "text / css"> body {font-family : Song; font-size: 12px;} TD {font-family: Song; Font-size: 12px; Background-color: #ffffff;} .bold {font-weight: bold; font-family: Song; Font-size : 12px; Background-Color: #ffffff;} .th {font-weight: bold; font-family: Song; Font-size: 12px; Background-Color: # 9cdcf1;} </ style> </ head> <body> <body > <% Hashcode = lcase (TRIM ("Hash")))] Level = LCase (TRIM ("" Level "))) IF level =" "" or not isnumeric (level) incapacity parameter "response.end end if isreload = request (" isreload ") safestr =" qwertyuiopasdfghjklzxcvbnm1234567890 "for i = 1 to len (hashcode) if instr (safestr, mid (hashcode, i, 1)) <1 then response.write" Error Hash code "response.end end if next hashfile = server.mappath (" XML / "& HashCode &" .xml ") set XML = Server.createObject (" Microsoft. Xmldom ") Xml.async = false xml.validateonparse = false xml.load (hashfile) ing (not (xml.readyState> 2)) or isreeload =" 1 "THEN SET http = server.createObject (" Microsoft.xmlhttp ") Http.open "get", "http://www2.sa20.com/btsearch0.php?keyword=" & have_query ", false http.send set s = server.createObject (" ADODB. "") S.TYPE = 2 S.Open S.Charset = "GB2312"</p> <p>s.writetext bin2str2 ​​(http.Responsebody) s.savetofile hashfile, 2 s.close set http = nothing xml.Load (hashfile) end if If xml.ReadyState> 2 Then Set SearchResult = xml.getElementsByTagName ( "SearchResult") If Cint (SearchResult.length)> 0 then Set BTInfo = SearchResult.Item (0) .getElementsByTagName ( "ResultSet"). Item (0) .getElementsByTagName ( "BTInfo") Set Category = BTInfo.Item (0) .getElementsByTagName ( "CategoryList ") .item (0) .getelementsBytagname (" category ") set tinfo = btinfo.item (0) .GetelementSbyTagname (" tinfo ") filename = btinfo.ientm (0) .getElementsBytagname (" filename "). item (0)). Item (0) .Text title = btinfo.item (0) .getelementSbyTagname ("Title"). Item (0) .text desc = ubbdecode (htmlencode (btinfo.item (0) .getElementsBytagname ("desc"). item (0) .text )) Sources = Tinfo.item (0) .GetaTribute ("Sourcees") filesize = ccur (btinfo.ientm (0) .Getattribute ("fsize") FileSize = FileSize / 1024 If FileSize> 1024 Then FileSize = FileSize / 1024 If FileSize> 1024 Then FileSize = FileSize / 1024 FileSize = FormatNumber (FileSize, 2, -1) & "GB" Else FileSize = FormatNumber (FileSize, 2, -1) & "MB "End if else filesis = formatNumber (FileSize, 2, -1) &" kb "end if connection = tinfo.item (0) Completed = Tinfo.item (0) .GetaTRibute ("</p> <p>Completed ") categorylist = category.item (2) .text & ">" & category.Item (1) .text & "> "& category.Item (0) .text elseif isreeload =" "" "" "" " ("Bt.asp? Hash =" & Hashcode & "& Level =" & Level & "& IsReload = 1") end if else response.write ("accident, this information is not successful, please try again) Response .End End If Set http = Nothing Set xml = Nothing Function bin2str2 ​​(binstr) Dim BytesStream, StringReturn Set BytesStream = server.createObject ( "ADODB.Stream") With BytesStream .Type = 2 .Open .WriteText binstr .Position = 0. charset = "GB2312" .Position = 2 StringReturn = .ReadText .close End With Set BytesStream = Nothing bin2str2 ​​= StringReturn End Function%> <table border = 0 bgcolor = # 666666 width = 70% align = center cellspacing = 1 cellpadding = 5 > <Tr> <td colspan = 2 class = th> Torrent file information - <a href="?hash=<%=hashcode% "& level = <% = level%> & isreload = 1"> Re-acquire </A> </ td> </ tr> <tr> <td class = bold align = right nowrap width = 60> Title </ td> <TD W IDTH = 100%> <% = title%> </ td> </ tr> <tr> <td class = bold align = Right Nowrap Width = 60> Size </ td> <td width = 100%> <% = Filesize%> </ td> </ tr> <tr> <td class = bold align = right nowrap width = 60> Seed number </ td> <td width = 100%> <font color = Green> <b> < % = Sourcees%> </ b> <</p> <p>/ font> </ td> </ tr> <tr> <td class = bold align = right nowrap width = 60> Connection number </ td> <td width = 100%> <font color = red> <b> < % = Connection%> </ b> </ font> </ td> </ tr> <tr> <td class = bold align = right nowrap width = 60> Complete number </ td> <td width = 100%> <font color = blue> <b> <% = completed%> </ b> </ font> </ td> </ tr> <tr> <td class = bold align = right nowrap width = 60> Type </ TD> <td width = 100%> <% = categoryList%> </ td> </ tr> <tr> <td class = bold align = right nowrap valign = top width = 60> Introduction </ TD> <TD Width = 100%> <% = desc%> </ td> </ tr> <tr> <td colspan = 2 class = bold align = center> <br> <b> <a href = "JavaScript: Self.close ) "> Close window </a </ b> </ td> </ tr> </ table> </ body> </ html> The following is a update post display page BT file information</p> <p>Java / J # code</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-75127.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="75127" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.045</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'N9K3cQA_2FrSTQ8BbzmXbIO1S98Nlm_2FkSbqSy_2BMeywGmhyRAdEmSYyOL_2FGc9TNXrrGGDSt_2Fgk_2FGf1SCiV3gB11TA_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>