Пример #1
0
 def get_blind_url(self, video_id, media_id, poster_url):
     resp = fetch_html(self.transform_video_api % (video_id, media_id, urllib.quote(poster_url)))
     try:
         data = json.loads(resp)
     except Exception:
         return
     result = data.get('result')
     return result.get('url'), result.get('cover_pic')
Пример #2
0
 def get_blind_url(self, video_id, media_id, poster_url):
     resp = fetch_html(self.transform_video_api %
                       (video_id, media_id, urllib.quote(poster_url)))
     try:
         data = json.loads(resp)
     except Exception:
         return
     result = data.get('result')
     return result.get('url'), result.get('cover_pic')
Пример #3
0
 def publish_proxies(self):
     api = 'http://api.zdaye.com/?api=201605061716313566&checktime=1%D0%A1%CA%B1%C4%DA&cunhuo=%B0%EB%D0%A1%CA%B1%D2%D4%C9%CF&gb=2'
     resp = fetch_html(api)
     try:
         for line in resp.split('\n'):
             line = line.strip('\r')
             proxy = 'http://' + line
             self.redis_cli.sadd(redis_config['proxy'], proxy)
     except Exception:
         pass
Пример #4
0
 def publish_proxies(self):
     api = 'http://api.zdaye.com/?api=201605061716313566&checktime=1%D0%A1%CA%B1%C4%DA&cunhuo=%B0%EB%D0%A1%CA%B1%D2%D4%C9%CF&gb=2'
     resp = fetch_html(api)
     try:
         for line in resp.split('\n'):
             line = line.strip('\r')
             proxy = 'http://' + line
             self.redis_cli.sadd(redis_config['proxy'], proxy)
     except Exception:
         pass
Пример #5
0
    def publish_article(self, url, media_name, media_id, title, content, video_id):
        data = {
            'media_name' : media_name,
            'media_id' : media_id,
            'title' : title,
            'content' : content,
            'import_hash' : hash_str(url),
            'date' : str_to_mcroseconds('2015-10-21 18:50:00'),
            'import_url' : url,
            'passed' : '1',
            'video_id' : video_id

        }
        headers = {
            'Content-Type' : 'application/json'
        }
        resp = fetch_html(self.post_api, headers=headers, body=json.dumps(data))
        print resp
Пример #6
0
 def publish_article(self, url, media_name, media_id, title, content,
                     video_id):
     data = {
         'media_name': media_name,
         'media_id': media_id,
         'title': title,
         'content': content,
         'import_hash': hash_str(url),
         'date': str_to_mcroseconds('2015-10-21 18:50:00'),
         'import_url': url,
         'passed': '1',
         'video_id': video_id
     }
     headers = {'Content-Type': 'application/json'}
     resp = fetch_html(self.post_api,
                       headers=headers,
                       body=json.dumps(data))
     print resp