<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=418193&amp;view=findpost&amp;p=3828569</guid>
        <pubDate>Thu, 16 Apr 2020 09:42:27 +0000</pubDate>
        <title>Перестал забирать контент с сайта</title>
        <link>https://forum.sources.ru/index.php?showtopic=418193&amp;view=findpost&amp;p=3828569</link>
        <description><![CDATA[Mutronics: Заставить забирать контент с сайта.]]></description>
        <author>Mutronics</author>
        <category>Python</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=418193&amp;view=findpost&amp;p=3828565</guid>
        <pubDate>Thu, 16 Apr 2020 08:39:02 +0000</pubDate>
        <title>Перестал забирать контент с сайта</title>
        <link>https://forum.sources.ru/index.php?showtopic=418193&amp;view=findpost&amp;p=3828565</link>
        <description><![CDATA[MIF: Вопрос-то какой?]]></description>
        <author>MIF</author>
        <category>Python</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=418193&amp;view=findpost&amp;p=3828562</guid>
        <pubDate>Thu, 16 Apr 2020 07:40:42 +0000</pubDate>
        <title>Перестал забирать контент с сайта</title>
        <link>https://forum.sources.ru/index.php?showtopic=418193&amp;view=findpost&amp;p=3828562</link>
        <description><![CDATA[Mutronics: Вчера плагин для kodi перестал забирать контент с сайта, функция GET возвращает пустоту, на сам сайт с браузера заходит.<br>
С других сайтов забирает без проблем, а вот с надлежащего сайта перестал.<br>
Никаких решений в интернете не нашел.<br>
Прокси не используется.<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">class ConnectionBuilder:</div><div class="code_line">&nbsp;&nbsp; &nbsp;def __init__(self, proxy):</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;self.proxy = proxy</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;def build_connection(self, cookiejar = None):</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if cookiejar is None:</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cookiejar = cookielib.CookieJar()</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;handlers = [urllib2.HTTPCookieProcessor(cookiejar),urllib2.HTTPSHandler(context=context),urllib2.HTTPRedirectHandler()]</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if not (self.proxy is None):</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.proxy.build_handlers(handlers)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;opener = urllib2.build_opener(*handlers)</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;opener.addheaders = [(&#39;User-Agent&#39;,&#39;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36&#39;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (&#39;Accept&#39;, &#39;*/*&#39;), (&#39;Accept-Language&#39;, &#39;ru-RU&#39;)]</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return opener</div><div class="code_line">&nbsp;</div><div class="code_line">def GET(target, post=None):</div><div class="code_line">&nbsp;&nbsp; &nbsp;try:</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;req = urllib2.Request(target, post)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;cookiejar = login_or_none()</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;url_opener = connection_builder.build_connection(cookiejar)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;http = None</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;with contextlib.closing(url_opener.open(req)) as resp:</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;http = resp.read()</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return http</div><div class="code_line">&nbsp;&nbsp; &nbsp;except Exception, e:</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;xbmc.log( &#39;[%s]: GET EXCEPT [%s]&#39; % (addon_id, e), 4 )</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;showMessage(&#39;HTTP ERROR&#39;, e, 5000)</div><div class="code_line">&nbsp;</div><div class="code_line">print GET(&#39;https://kinozal-tv.appspot.com/&#39;) #пустота</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script>]]></description>
        <author>Mutronics</author>
        <category>Python</category>
      </item>
	
      </channel>
      </rss>
	