source: titan/mediathek/localhoster/cloudflare.py @ 39520

Last change on this file since 39520 was 39520, checked in by obi, 5 years ago

first step movie4

File size: 925 bytes
Line 
1
2import urllib2
3from lib import helpers
4import sys
5from lib.net import Net
6import lib.common as common
7
8class CloudflareResolver(object):
9    def __init__(self):
10#        self.net = Net(cookie_file='/mnt/network/cookies', http_debug=True, cloudflare=True)
11        self.net = Net(cookie_file='/mnt/network/cookies', cloudflare=True)
12        url = str(sys.argv[1])
13        return self.get_answer_code(url)
14
15    def get_answer_code(self, web_url):
16        headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Maxthon/4.4.7.3000 Chrome/30.0.1599.101 Safari/537.36'}                 
17        html = self.net.http_GET(web_url, headers=headers).content
18        #html = self.request(web_url, cookie_file=/mnt/network/cookies, cloudflare=True)
19        ret = self.net.save_cookies('/mnt/network/cookies')     
20        print "html", html.encode('utf8')
21
22sys.stdout = CloudflareResolver()
Note: See TracBrowser for help on using the repository browser.