当前位置: 首页>>代码示例>>Python>>正文


Python Profile.img_more_captions方法代码示例

本文整理汇总了Python中models.Profile.img_more_captions方法的典型用法代码示例。如果您正苦于以下问题:Python Profile.img_more_captions方法的具体用法?Python Profile.img_more_captions怎么用?Python Profile.img_more_captions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Profile的用法示例。


在下文中一共展示了Profile.img_more_captions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_user_data

# 需要导入模块: from models import Profile [as 别名]
# 或者: from models.Profile import img_more_captions [as 别名]
def get_user_data(user, url, soup, br):
  #logging.info('Inside get user data function')
  userId = url

  user_data = Profile.get_by_id(userId)
  img_more = []
  img_more_captions = []

  # If this is a new profile
  if not user_data:
    #logging.info('new profile')
    # Get the last online time
    if soup.find('span', {'class': 'fancydate'}) != None:
      last_online = soup.find('span', {'class': 'fancydate'}).text
    else:
      last_online = 'Online now!'
    #logging.info('got the date')
    # logging.info(user.key)
    #logging.info(soup.prettify())

    # img = str(soup.find(id='thumb0_a').find('img')['src'])
    # logging.info(img)
    # match = str(soup.find('span', {'class': 'match'}).text.split('%')[0])
    # logging.info(match)
    # friend = str(soup.find('span', {'class': 'friend'}).text.split('%')[0])
    # logging.info(friend)
    # enemy = str(soup.find('span', {'class': 'enemy'}).text.split('%')[0])
    # logging.info(enemy)
    # age = str(soup.find(id='ajax_age').text)
    # logging.info(age)
    # orientation = str(soup.find(id='ajax_orientation').text)
    # logging.info(orientation)
    # status = str(soup.find(id='ajax_status').text)
    # logging.info(status)
    # location = str(soup.find(id='ajax_location').text)
    # logging.info(location)
    # ethnicity = str(soup.find(id='ajax_ethnicities').text)
    # logging.info(ethnicity)
    # height = soup.find(id='ajax_height').text
    # logging.info(height)
    # body_type = str(soup.find(id='ajax_bodytype').text)
    # logging.info(body_type)
    # diet = str(soup.find(id='ajax_diet').text)
    # logging.info(diet)
    # smoking = str(soup.find(id='ajax_smoking').text)
    # logging.info(smoking)
    # drinking = str(soup.find(id='ajax_drinking').text)
    # logging.info(drinking)
    # drugs = str(soup.find(id='ajax_drugs').text)
    # logging.info(drugs)
    # religion = soup.find(id='ajax_religion').text
    # logging.info(religion)
    # sign = soup.find(id='ajax_sign').text
    # logging.info(sign)
    # education = str(soup.find(id='ajax_education').text)
    # logging.info(education)
    # income = soup.find(id='ajax_income').text
    # logging.info(income)
    # pets = soup.find(id='ajax_pets').text
    # logging.info(pets)
    # languages = str(soup.find(id='ajax_languages').text)
    # logging.info(languages)
    # essay_text_0 = unicode(soup.find(id='essay_text_0'))    
    # essay_text_1 = unicode(soup.find(id='essay_text_1'))
    # essay_text_2 = unicode(soup.find(id='essay_text_2'))
    # essay_text_3 = unicode(soup.find(id='essay_text_3'))
    # essay_text_4 = unicode(soup.find(id='essay_text_4'))
    # essay_text_5 = unicode(soup.find(id='essay_text_5'))
    # essay_text_6 = unicode(soup.find(id='essay_text_6'))
    # essay_text_7 = unicode(soup.find(id='essay_text_7'))
    # essay_text_8 = unicode(soup.find(id='essay_text_8'))
    # essay_text_9 = unicode(soup.find(id='essay_text_9'))
    # what_i_want = unicode(soup.find(id='what_i_want'))
    # logging.info(essay_text_0)
    # logging.info(essay_text_1)
    # logging.info(essay_text_2)
    # logging.info(essay_text_3)
    # logging.info(essay_text_4)
    # logging.info(essay_text_5)
    # logging.info(essay_text_6)
    # logging.info(essay_text_7)
    # logging.info(essay_text_8)
    # logging.info(essay_text_9)
    # logging.info(what_i_want)
    # logging.info(last_online)
    # logging.info([user.key])

    user_data = Profile(
      id = userId,
      username = userId,
      img = unicode(soup.find(id='thumb0_a').find('img')['src']),
      match = unicode(soup.find('span', {'class': 'match'}).text.split('%')[0]),
      friend = unicode(soup.find('span', {'class': 'friend'}).text.split('%')[0]),
      enemy = unicode(soup.find('span', {'class': 'enemy'}).text.split('%')[0]),
      age = unicode(soup.find(id='ajax_age').text),
      gender = unicode(soup.find(id='ajax_gender').text),
      orientation = unicode(soup.find(id='ajax_orientation').text),
      status = unicode(soup.find(id='ajax_status').text),
      location = unicode(soup.find(id='ajax_location').text),
      ethnicity = unicode(soup.find(id='ajax_ethnicities').text),
#.........这里部分代码省略.........
开发者ID:robertdo,项目名称:cupid-crawler,代码行数:103,代码来源:browser.py


注:本文中的models.Profile.img_more_captions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。