Exemple #1
0
 def play_info(self, db_tv_infos):
     url = 'http://data.video.qq.com/fcgi-bin/data?tid=70&&appid=10001007&appkey=e075742beb866145&callback=callback&low_login=1&idlist={}&otype=json' # noqa
     play_dir = PLAY_INFO_FILE_DIR + SAVE_FILE
     utils.mkdir(play_dir)
     for tv_info in db_tv_infos:
         if tv_info.type in [u'电视剧']:
             # print u"抓取《{}》播放信息中".format(tv_info.name)
             warning_message = u"qq Warning《{}》play_info ,结果不准确\r\n". \
                               format(tv_info.name)
             page = request(url.format(tv_info.tv_id))
             if not play_info_is_valid_qq(page):
                 utils.log(message=warning_message)
                 continue
             utils.write(play_dir, tv_info.name +
                         PLAY_INFO_FILE_FIX, page)
         elif tv_info.type in [u'综艺']:
             vids = tv_info.vids.split(',')
             episodes = tv_info.detail_episodes.split(',')
             for vid, episode in zip(vids, episodes):
                 # print u"抓取《{}》第{}期播放信息中。。。".format(tv_info.name, episode)
                 warning_message = u"qq《{}》第{}期play_info ,结果不准确\r\n". \
                                   format(tv_info.name, episode)
                 page = request(url.format(vid))
                 if not play_info_is_valid_qq(page):
                     utils.log(message=warning_message)
                     continue
                 utils.write(play_dir, tv_info.name + episode +
                             PLAY_INFO_FILE_FIX, page)
Exemple #2
0
 def tv_info(self, tv_names):
     url = 'http://s.video.qq.com/search?comment=1&plat=2&otype=json&query={}&callback=callback'  # noqa
     info_dir = TV_INFO_FILE_DIR + SAVE_FILE
     utils.mkdir(info_dir)
     for name in tv_names:
         warning_message = u"qq Warning《{}》tv_info ,结果不准确\r\n". \
                           format(name)
         page = request(url.format(name.encode('utf8')))
         if not tv_info_is_valid_qq(page):
             utils.log(message=warning_message)
             continue
         utils.write(info_dir, name + TV_INFO_FILE_FIX,
                     page.encode('utf8'))