直到几天前,这些休息代码工作正常,但过去几天出现了问题,它开始打开网站,好像我在手机上或其他东西。 代码:
BufferedReader br = new BufferedReader(new InputStreamReader(new GZIPInputStream
(new URL("http://thepiratebay.se/search/" + input.replace(" ", "%20") +
"/0/7/207").openStream())));
当我保存页面时,它会打开:
<!DOCTYPE html>
<!--[if lt IE 7 ]>
<html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]>
<html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]>
<html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Download music, movies, games, software! The Pirate Bay - The galaxy's most resilient BitTorrent site</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="/stylesheets/base-min.css">
<link rel="stylesheet" href="/stylesheets/skeleton-min.css">
<link rel="stylesheet" href="/stylesheets/layout-min.css">
<link rel="stylesheet" href="/stylesheets/tpb-min.css">
<!--[if lt IE 9]>
<script src="/js/html5-min.js"></script>
<![endif]-->
<link rel="shortcut icon" href="/images/favicon.ico">
<link rel="apple-touch-icon" href="/images/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="/images/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="/images/apple-touch-icon-114x114.png">
<link rel="dns-prefetch" href="http://adexprt.com">
<link rel="dns-prefetch" href="http://main.exoclick.com">
<link rel="dns-prefetch" href="http://ads.exoclick.com">
<link rel="dns-prefetch" href="http://cdn.mobicow.com">
<link rel="dns-prefetch" href="http://1phads.com">
<link rel="dns-prefetch" href="http://traffic.trafficposse.com">
<link rel="dns-prefetch" href="http://traffic.broker.to">
<script src="/js/script-min.js"></script>
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Search The Mobile Bay"/>
<script>
function updatetopbanners() {
if (window.innerWidth >= 960) {
var adtop = "<iframe src='http://adexprt.com/m/e/r/h_728x90.html' frameborder='0' scrolling='no' width='728' height='90' allowtransparency='true'></iframe>";
}
else if (window.innerWidth >= 768) {
var adtop = "<iframe src='http://adexprt.com/m/e/r/h_468x60.html' frameborder='0' scrolling='no' width='468' height='60' allowtransparency='true'></iframe>";
}
else {
var adtop = "<iframe src='http://adexprt.com/m/e/r/h_300x100.html' frameborder='0' scrolling='no' width='300' height='100' allowtransparency='true'></iframe>";
}
document.getElementById("adrestop").innerHTML = adtop;
}
function updatebotbanners(timesup) {
document.getElementById("adresbtn").innerHTML = '';
if (timesup) {
setTimeout(function () {
updatebotbanners(0)
}, 500);
}
else {
if (window.innerWidth >= 960) {
var adbottom = "<iframe src='http://adexprt.com/m/e/r/f_300x250.html' frameborder='0' scrolling='no' width='300' height='250' allowtransparency='true'></iframe><iframe src='http://adexprt.com/m/e/r/f_300x250.html' frameborder='0' scrolling='no' width='300' height='250' allowtransparency='true'></iframe><iframe src='http://adexprt.com/m/e/r/f_300x250.html' frameborder='0' scrolling='no' width='300' height='250' allowtransparency='true'></iframe>";
}
else if (window.innerWidth >= 768) {
var adbottom = "<iframe src='http://adexprt.com/m/e/r/f_300x250.html' frameborder='0' scrolling='no' width='300' height='250' allowtransparency='true'></iframe><iframe src='http://adexprt.com/m/e/r/f_300x250.html' frameborder='0' scrolling='no' width='300' height='250' allowtransparency='true'></iframe>";
}
else {
var adbottom = "<iframe src='http://adexprt.com/m/e/r/f_300x250.html' frameborder='0' scrolling='no' width='300' height='250' allowtransparency='true'></iframe>";
}
document.getElementById("adresbtn").innerHTML = adbottom;
}
}
function updatedlbuttons()
{
}
var androidoverlay = 0;
var androidoverlaycookie = 604800;
</script>
<script type="text/javascript">if (top.location != self.location) { top.location.replace(self.location); }</script>
</head>
<body>
<div id="overlay">
<div id="overlaypopup">
<div class="overlaytext">Try our new android application!</div>
<div id="overlaylogo"></div>
<div id="overlaydownloadlink"><a href="#" target="_blank" onclick="overhide();">Download for free!</a></div>
<div id="overlayhidelink"><a href="#" onclick="overhide();">No, continue site viewing</a></div>
</div>
</div><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
<div class="container">
<div class="sixteen columns" id="adrestop" style="text-align: center;">
</div>
<div class="sixteen columns" style="text-align: center;">
<a href="/" style="border: 0;"><img alt="" style="border: 0;" src="/images/tpb.jpg"></a>
</div>
<div class="sixteen columns" style="text-align: center;">
<div id="err">
<h2>Not Found (aka 404)</h2>
<p>You're looking for something that does not, has not, will not, might not or must not exist ...</p>
<p>... but you're always welcome to search for it.</p>
</div>
</div>
<div class="sixteen columns" style="text-align: center;">
<ul class="nav navtop">
<li><a title="Search Torrents" href="/" class="topmenu" >Search<span class="hdn768"> Torrents</span></a></li>
<li><a title="Browse Torrents" href="/browse" class="topmenu" >Browse<span class="hdn768"> Torrents</span></a></li>
<li><a title="Recent Torrents" href="/recent" class="topmenu" >Recent<span class="hdn768"> Torrents</span></a></li>
<li><a title="Top 100" href="/top" class="topmenu" id="nomargin">Top 100</a></li>
<li style="clear:both"></li>
</ul>
</div>
<form action="/search.php" method="get" id="q">
<div class="clearfix">
<div class="four columns" style="height: 1px;"></div>
<div class="eight columns" style="text-align: center; margin: 1em auto;">
<input type="text" id="regularInput" placeholder="Pirate Search" name="q" style="width: 90%;margin: 0 auto;"/>
</div>
<div class="four columns" style="height: 1px;"></div>
</div>
<div class="sixteen columns" style="text-align: center; margin-bottom: 0.5em;">
<ul class="nav">
<li><label title="All" accesskey="a"><input id="all" onclick="setAll();" checked=""
type="checkbox">All</label>
</li>
<li><label title="Audio" accesskey="q"><input name="audio" id="audio" onclick="rmAll();"
type="checkbox">Audio</label></li>
<li><label title="Video" accesskey="w"><input name="video" id="video" onclick="rmAll();"
type="checkbox">Video</label></li>
<li><label title="Applications" accesskey="e"><input name="apps" id="apps" onclick="rmAll();"
type="checkbox">Applications</label></li>
<li><label title="Games" accesskey="r"><input name="games" id="games" onclick="rmAll();" type="checkbox">Games</label>
</li>
<li><label title="Porn" accesskey="t"><input name="porn" id="porn" onclick="rmAll();"
type="checkbox">Porn</label></li>
<li><label title="Other" accesskey="y"><input name="other" id="other" onclick="rmAll();"
type="checkbox">Other</label></li>
<li><select onchange="javascript:setAll();" name="category" id="category">
<option value="0">All</option>
<optgroup label="Audio">
<option value="101">Music</option>
<option value="102">Audio books</option>
<option value="103">Sound clips</option>
<option value="104">FLAC</option>
<option value="199">Other</option>
</optgroup>
<optgroup label="Video">
<option value="201">Movies</option>
<option value="202">Movies DVDR</option>
<option value="203">Music videos</option>
<option value="204">Movie clips</option>
<option value="205">TV shows</option>
<option value="206">Handheld</option>
<option value="207">HD - Movies</option>
<option value="208">HD - TV shows</option>
<option value="209">3D</option>
<option value="299">Other</option>
</optgroup>
<optgroup label="Applications">
<option value="301">Windows</option>
<option value="302">Mac</option>
<option value="303">UNIX</option>
<option value="304">Handheld</option>
<option value="305">IOS (iPad/iPhone)</option>
<option value="306">Android</option>
<option value="399">Other OS</option>
</optgroup>
<optgroup label="Games">
<option value="401">PC</option>
<option value="402">Mac</option>
<option value="403">PSx</option>
<option value="404">XBOX360</option>
<option value="405">Wii</option>
<option value="406">Handheld</option>
<option value="407">IOS (iPad/iPhone)</option>
<option value="408">Android</option>
<option value="499">Other</option>
</optgroup>
<optgroup label="Porn">
<option value="501">Movies</option>
<option value="502">Movies DVDR</option>
<option value="503">Pictures</option>
<option value="504">Games</option>
<option value="505">HD - Movies</option>
<option value="506">Movie clips</option>
<option value="599">Other</option>
</optgroup>
<optgroup label="Other">
<option value="601">E-books</option>
<option value="602">Comics</option>
<option value="603">Pictures</option>
<option value="604">Covers</option>
<option value="605">Physibles</option>
<option value="699">Other</option>
</optgroup>
</select></li>
</ul>
</div>
<div class="sixteen columns" style="text-align: center; margin-bottom: 10px;">
<button type="submit" style="margin-bottom: 0;">Pirate Search</button>
<button name="lucky" value="1" type="submit" style="margin-bottom: 0;">I'm feeling lucky</button>
</div>
<div class="sixteen columns nowrap" style="text-align: center; margin-bottom: 10px;">
<table style="margin: 0; padding: 0; border: 0; width: 100%;"><tr>
<td style="text-align: right; vertical-align: top; width: 50%;">
<iframe src="//www.facebook.com/plugins/like.php?locale=en_US&href=http%3A%2F%2Fthemobilebay.com%2F&width=109&layout=button_count&action=like&show_faces=false&share=false&height=26" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:26px;" allowTransparency="true"></iframe>
</td>
<td style="text-align: left; padding-left: 5px; ">
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://themobilebay.com" data-text="Download music, movies, games, software! The Pirate Bay - The galaxy's most resilient BitTorrent site">Tweet</a>
</td>
</tr></table>
</div>
</form>
<div class="sixteen columns" id="adresbtn" style="text-align: center;">
</div>
<!--
<div class="sixteen columns" style="text-align: center; margin: 10px;">
<a title="How do I download?" href="/help" style="font-size: 1.2em; border: 0; font-weight:bold;">How do I download?</a>
</div>
-->
<div class="sixteen columns" style="text-align: center; margin: 0.5em;">
<ul class="nav ltl">
<li><a href="/about" title="About">About</a></li>
<li>|</li>
<li><a href="/legal" title="Legal threats">Legal threats</a></li>
<li>|</li>
<li><a href="/policy" title="Usage policy">Usage policy</a></li>
<li>|</li>
<li><a href="/contact" title="Contact us">Contact us</a></li>
<li>|</li>
<li><a href="/downloads" title="Downloads">Downloads</a></li>
<li>|</li>
<li><a href="http://www.promobay.org/" target="_blank" title="Promo">Promo</a></li>
<li>|</li>
<li><a href="http://suprbay.org/" title="Forum" target="_blank">Forum</a></li>
</ul><ul class="nav ltl">
<li><a href="http://piratebrowser.com/" title="PirateBrowser" target="_blank"><strong>PirateBrowser</strong></a>
<li>|</li>
<li><a href="http://bayfiles.net" title="Bayfiles" target="_blank"><strong>Bayfiles</strong></a></li>
<li>|</li>
<li><a href="http://bayimg.com" title="BayImg" target="_blank">BayImg</a></li>
<li>|</li>
<li><a href="http://pastebay.net" title="PasteBay" target="_blank">PasteBay</a></li>
<li>|</li>
<li><a href="http://uberproxy.net" title="Proxy" target="_blank">Proxy</a></li>
<li>|</li>
<li><a href="http://twitter.com/tpbdotorg" title="Follow TPB on Twitter" target="_blank">Follow TPB on
Twitter</a></li>
<li>|</li>
<li><a href="https://www.facebook.com/ThePirateBayWarMachine" title="Follow TPB on Facebook" target="_blank">Follow
TPB on Facebook</a></li>
</ul>
</div>
<div style="text-align: center;">
6.673.951 registered users Last updated 21:50:06.<br />
47.559.311 peers (35.970.174 seeders + 11.589.137 leechers) in 6.170.074 torrents.</div>
<script>
function setAll()
{
document.forms['q'].elements['audio'].checked = false;
document.forms['q'].elements['video'].checked = false;
document.forms['q'].elements['apps'].checked = false;
document.forms['q'].elements['games'].checked = false;
document.forms['q'].elements['porn'].checked = false;
document.forms['q'].elements['other'].checked = false;
}
function rmAll() { document.forms['q'].elements['all'].checked = false;
var dd = document.forms['q'].elements['category'];
for (var i = 0; i < dd.options.length; i++) {
if (dd.options[i].text === 'All') {
dd.selectedIndex = i;
break;
}
}
}
</script>
<div class="sixteen columns" style="text-align: center; margin: 10px auto 0 auto;">
<a target="_blank" href="http://bitcoin.org">BitCoin</a>:<b> <a href="bitcoin:1KeBs4HBQzkdHC2ou3gpyGHqcL7aKzwTve">1KeBs4HBQzkdHC2ou3gpyGHqcL7aKzwTve</a></b>
<br /><br />
<a target="_blank" href="http://litecoin.org">Litecoin</a>:<a href="litecoin:LiYp3Dg11N5BgV8qKW42ubSZXFmjDByjoV">LiYp3Dg11N5BgV8qKW42ubSZXFmjDByjoV</a><br />
</div>
<div class="sixteen columns" style="text-align: center; margin: 10px auto;"><a href="http://thepiratebay.se/usemainsite.php?path=//search/need%20for%20speed/0/7/207">Return to the web version</a></div>
<div class="sixteen columns rss">
<div class="rssins">
<a title="RSS" style="border: 0; text-decoration: none; " href="/rss">
<img alt="RSS" style="border: 0; " src="/images/rss.png">
</a></div>
</div>
</div>
</body>
</html>
正如您所看到的,最后一行是:
<div class="sixteen columns" style="text-align: center; margin: 10px auto;"><a href="http://thepiratebay.se/usemainsite.php?path=//search/need%20for%20speed/0/7/207">Return to the web version</a></div>
我猜这意味着我已经达到某种移动版本的网站。 无论如何都要过去吗?
答案 0 :(得分:0)
我找到了解决方案(至少我希望它是......)。我已将代码更改为:
URL url = new URL("http://thepiratebay.se/search/" + input.replace(" ", "%20") + "/0/7/207");
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
httpCon.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36");
BufferedReader br = new BufferedReader(
new InputStreamReader( GZIPInputStream(httpCon.getInputStream())));
它运作得很好。 但我正在跳跃,也许有人可以解释这里发生的事情:
httpCon.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36");