source: titan/mediathek/localhoster/goldesel.py @ 39400

Last change on this file since 39400 was 39400, checked in by tt4sk, 6 years ago

First call of goldesel.to with goldesel.py / net.py, store cookie in /mnt/network/cookies, following calls with curl using same cookie and user agent.

File size: 930 bytes
Line 
1
2import urllib2
3from lib import helpers
4import sys
5from lib.net import Net
6import lib.common as common
7
8class GoldeselResolver(object):
9    name = "briskfile"
10    domains = ["goldesel.to"]
11    pattern = '(?://|\.)(goldesel\.to)/(?:l|e)/([0-9A-Za-z\-]+)'
12
13    def __init__(self):
14#        self.net = Net(cookie_file='/mnt/network/cookies', http_debug=True, cloudflare=True)
15        self.net = Net(cookie_file='/mnt/network/cookies', cloudflare=True)
16        url = str(sys.argv[1])
17        return self.get_answer_code(url)
18
19    def get_answer_code(self, web_url):
20        headers = {'User-Agent': common.FF_USER_AGENT}                 
21        html = self.net.http_GET(web_url, headers=headers).content
22        #html = self.request(web_url, cookie_file=/mnt/network/cookies, cloudflare=True)
23        ret = self.net.save_cookies('/mnt/network/cookies')     
24        print "html", html.encode('utf8')
25
26sys.stdout = GoldeselResolver()
Note: See TracBrowser for help on using the repository browser.