Beispiel #1
0
def book_search_KFZ(request, key):
    #KFZ
    kfz = KFZBookList()
    kfz.mSite = kfz.mSite + kfz.charToUnicode(key)
    kfzlists = kfz.getbooklist(kfz.mSite)
    kfzinfo = ""
    for book in kfzlists:
        if len(book) > 0:
            kfzinfo = kfzinfo + str(book) + "<hr>"

    return render_to_response('booklist_Single.html', {
        "key": key,
        "BookList": kfzinfo,
        "sitename": "www.kongfz.com"
    })
Beispiel #2
0
def book_search(request, key):
    #Jingdong
    jd = JDBookList()
    jd.mSite = jd.mSite.replace("xxx", urllib.quote(
        key.encode("utf8")))  #key.replace(" ", "%20")
    tjdlists = jd.getbooklist(jd.mSite)
    jdbooks = ""
    for book in tjdlists:
        jdbooks = jdbooks + str(book).replace("data-lazyload", "src") + "<hr>"

    #dangdang
    dd = DDBookList()
    dd.mSite = dd.mSite.replace("xxx", urllib.quote(key.encode("gb2312")))
    tddlists = dd.getbooklist(dd.mSite)
    ddbooks = ""
    for book in tddlists:
        if len(book) > 0:
            ddbooks = ddbooks + ('<li class="line' +
                                 str(book) + '</li>').replace(
                                     "data-original", "src") + "<hr>"

    #Amazon
    zn = AmazonBookList()
    zn.mSite = zn.mSite.replace("xxx", key)
    znlists = zn.getbooklist(zn.mSite)
    zninfo = ""
    for book in znlists:
        if len(book) > 0:
            zninfo = zninfo + str(book) + "<hr>"

    #KFZ
    kfz = KFZBookList()
    kfz.mSite = kfz.mSite + kfz.charToUnicode(key)
    kfzlists = kfz.getbooklist(kfz.mSite)
    kfzinfo = ""
    for book in kfzlists:
        if len(book) > 0:
            kfzinfo = kfzinfo + str(book) + "<hr>"

    return render_to_response(
        'booklist.html', {
            "key": key,
            "JDbooklist": jdbooks,
            "DDbooklist": ddbooks,
            "AmazonBookList": zninfo,
            "KFZBookList": kfzinfo
        })