예제 #1
0
def tran2pg_parse(url=None,
                  author=None,
                  public_time=None,
                  page_source=None,
                  content=None,
                  website_name=None,
                  channel_name=None,
                  title=None,
                  topic=None,
                  tag=None,
                  meta_keywords=None,
                  pic=None,
                  flag=None):
    '''
    转换为ORM obj
    '''
    crawlt = get_now_str()
    crawld = get_date_str()
    hid = str_simhash(crawlt + url)
    obj = Jz_dongfangcaifu_content(url=url,
                                   author=author,
                                   public_time=public_time,
                                   collection_time=crawlt,
                                   page_source=str(page_source),
                                   content=content,
                                   website_name=website_name,
                                   channel_name=channel_name,
                                   title=title,
                                   topic=topic,
                                   tag=tag,
                                   meta_keywords=meta_keywords,
                                   write_date=crawld,
                                   pic=pic,
                                   flag=flag)
    return hid, obj
예제 #2
0
def tran2pg(ps=None, url=None, flag=None):
    '''
    转换为ORM obj
    '''
    crawlt = get_now_str()
    crawld = get_date_str()
    _hid = str_simhash(crawlt + url)
    _obj = Jz_dongfangcaifu_PageSource(uid=_hid,
                                       url=url,
                                       collection_time=crawlt,
                                       pagesource=ps,
                                       flag=flag,
                                       write_date=crawld)
    return _hid, _obj