Пример #1
0
    def getChannel(self, channel, page=1):
        baseurl = '%s%s' % (self.domain, channel)
        if page == 1:
            response = Request().get(baseurl)
            api_type, api_value = Channel().get_api_type(response)
        else:
            api_type, api_value = channel.split('|')

        # https://fimfast.com/api/v2/films/cinema?offset=24&limit=24
        if api_type:
            if api_type == 'cinema':
                url = '%s/films/cinema?offset=%d&limit=24' % (self.api,
                                                              (page - 1) * 24)
            else:
                url = '%s/films?offset=%d&limit=24&%s=%s' % (
                    self.api, (page - 1) * 24, api_type, api_value)

        response = Request().get(url,
                                 headers={
                                     'referer': baseurl,
                                     'authority': 'fimfast.com',
                                     'x-requested-with': 'XMLHttpRequest',
                                 })

        return Channel().get(response, page, api_type, api_value)
Пример #2
0
    def search(self, text):
        # https://fimfast.com/api/v2/search?q=nu%20hon&limit=12
        url = "%s/search?q=%s&limit=12" % (self.api, urllib.quote_plus(text))
        response = Request().get(url, headers={
            'referer': self.domain,
            'x-requested-with': 'XMLHttpRequest',
        })

        return Channel().get(response, 1)
Пример #3
0
    def search(self, text):
        # https://fimfast.com/api/v2/search?q=nu%20hon&limit=12
        # https://fimfast.com/tim-kiem/sieu%20diep%20vien
        url = "%s/tim-kiem/%s" % (self.domain, text)
        response = self.request.get(url, headers={
            'referer': self.domain,
            # 'x-requested-with': 'XMLHttpRequest',
        })

        return Channel().get(response, 1)
Пример #4
0
    def getChannel(self, channel, page=1):
        channel = channel.replace(self.domain, '')
        baseurl = '%s%s' % (self.domain, channel)
        if page == 1:
            response = self.request.get(baseurl)
        else:
            baseurl = "{}?page={}".format(baseurl, page)
            response = self.request.get(baseurl)

        return Channel().get(response, page)
Пример #5
0
 def getCategory(self):
     response = self.request.get(self.domain)
     return Category().get(response), Channel().get(response, 1)