Example #1
0
    def __init__(self):
        if not helper.getSetting('fcine.username'):
            # helper.message('Please login to fcine.net', 'Login Required')
            self.username = '******'
            self.password = '******'
        else:
            self.username = helper.getSetting('fcine.username'),
            self.password = helper.getSetting('fcine.password'),

        self.request = Request(header={
            'User-Agent': 'Mozilla/5.0',
            'origin': 'https://fcine.net',
            'referer': 'https://fcine.net/login/',
        },
                               session=True)

        if helper.has_file_path(
                'fcine.bin'
        ) and helper.get_last_modified_time_file('fcine.bin') + 43200 < int(
                time.time()):
            helper.remove_file('fcine.bin')

        if helper.has_file_path('fcine.bin'):
            self.request.set_session(
                pickle.loads(helper.read_file('fcine.bin', True)))
        else:
            self.login()
Example #2
0
    def __init__(self):
        if not helper.getSetting('hdvietnam.username'):
            self.username = '******'
            self.password = '******'
        else:
            self.username = helper.getSetting('hdvietnam.username')
            self.password = helper.getSetting('hdvietnam.password')

        self.request = Request(header={
            'User-Agent': 'Mozilla/5.0',
            'Origin': self.domain,
            'Referer': self.domain
        },
                               session=True)

        if helper.has_file_path(
                'hdvietnam.bin'
        ) and helper.get_last_modified_time_file('hdvietnam.bin') + 3600 < int(
                time.time()):
            helper.remove_file('hdvietnam.bin')

        if helper.has_file_path('hdvietnam.bin'):
            self.request.set_session(
                pickle.loads(helper.read_file('hdvietnam.bin', True)))
        else:
            self.login()
Example #3
0
    def __init__(self):
        self.request = Request(session=True)
        if helper.has_file_path(
                'xomphimhay.bin') and helper.get_last_modified_time_file(
                    'xomphimhay.bin') + 43200 < int(time.time()):
            helper.remove_file('xomphimhay.bin')

        if helper.has_file_path('xomphimhay.bin'):
            with open(helper.get_file_path('xomphimhay.bin')) as f:
                self.request.set_session(pickle.load(f))
            cookies_jar = self.request.get_request_session().cookies
            cookies_jar.set('vietnamese',
                            'true',
                            domain='xomphimhay.com',
                            path='/')
Example #4
0
    def __init__(self, url, username="", password=""):
        self.token = None
        self.url = url
        self.username = username
        self.password = password
        self.request = Request(session=True)
        if helper.has_file_path(
                'fshare.bin'
        ) and helper.get_last_modified_time_file('fshare.bin') + 43200 < int(
                time.time()):
            helper.remove_file('fshare.bin')

        if helper.has_file_path('fshare.bin'):
            with open(helper.get_file_path('fshare.bin')) as f:
                cache = pickle.load(f)
                self.request.get_request_session().cookies.set(
                    'session_id', cache.get('session_id'))
Example #5
0
 def __init__(self):
     if helper.has_file_path('phimbathu.bin') and helper.get_last_modified_time_file('phimbathu.bin') + 43200 > \
             int(time.time()):
         with open(helper.get_file_path('phimbathu.bin')) as f:
             self.cookies = pickle.load(f)
     else:
         self.updateSession(self.domain)
     self.request = Request()
Example #6
0
    def updateSession(self, url, delay=10):
        scraper = CloudScraper.create_scraper(delay=delay)
        scraper.headers.update({'User-Agent': user_agent})
        self.cookies = scraper.get(url).cookies.get_dict()
        if not helper.has_file_path('phimbathu.bin'):
            helper.write_file('phimbathu.bin', '')

        with open(helper.get_file_path('phimbathu.bin'), 'wb+') as f:
            pickle.dump(self.cookies, f)
Example #7
0
 def __init__(self):
     self.request = Request(session=True)
     if helper.has_file_path('xomphimhay.bin'):
         with open(helper.get_file_path('xomphimhay.bin')) as f:
             self.request.set_session(pickle.load(f))
         cookies_jar = self.request.get_request_session().cookies
         cookies_jar.set('vietnamese',
                         'true',
                         domain='xomphimhay.com',
                         path='/')
         print cookies_jar
Example #8
0
    def updateSession(self):
        if not helper.has_file_path('xomphimhay.bin'):
            helper.write_file('xomphimhay.bin', '')

        with open(helper.get_file_path('xomphimhay.bin'), 'wb+') as f:
            pickle.dump(self.request.get_request_session(), f)