Пример #1
0
def result_page():
    url = request.url
    page = request.args.get('sp')
    favorite_video = []
    user_favorite = Video.find_video(session['account'])
    for video in user_favorite:
        favorite_video.append(video['link'])
    if page is None:
        search = request.args.get('search')
        soup = item.find_search_content(search)
        all_item = item.every_video(soup)
        all_page = item.page_bar(soup)
        return render_template("result.html", search=search, all_item=all_item, all_page=all_page, url=url,
                               favorite_video=favorite_video)
    elif page is not None:
        search = request.args.get('q')
        page = request.args.get('sp')
        current_page = request.args.get('current_page')
        value = "q={}".format(search) + "&" + "sp={}".format(page)
        soup = item.find_page_content(value)
        all_item = item.every_video(soup)
        all_page = item.page_bar(soup)
        return render_template("result_page.html", search=search, all_item=all_item, all_page=all_page,
                               current_page=current_page, int=int, url=url, favorite_video=favorite_video)
    else:
        return redirect("/")
Пример #2
0
def category_method():
    url = request.url
    favorite_video = []
    user_favorite = Video.find_video(session['account'])
    for video in user_favorite:
        favorite_video.append(video['Link'])

    category = "https://www.imovie4u.com/genre/horror/"
    soup = item.find_home_content(category)
    all_movie = item.find_home_movie(soup)

    return render_template("category.html",
                           all_movie=all_movie,
                           url=url,
                           favorite_video=favorite_video)
Пример #3
0
def result_page():
    url = request.url
    favorite_video = []
    user_favorite = Video.find_video(session['account'])
    for video in user_favorite:
        favorite_video.append(video['Link'])
    search = request.args.get('search')
    soup = item.find_search_content(search)
    all_movie = item.every_movie(soup)

    return render_template("result.html",
                           result=search,
                           all_movie=all_movie,
                           url=url,
                           favorite_video=favorite_video)
Пример #4
0
def favorite_method():
    if session['account']:
        if request.method == 'POST':
            url = request.form['url']
            title = request.form['title']
            link = request.form['link']
            img = request.form['img']
            account = session['account']
            Video(account, title, link, img).save_to_db()
            return redirect(url)
        else:
            account = session['account']
            user_video = Video.find_video(account)
            return render_template("favorite.html", user_video=user_video)
    else:
        return redirect("/login")
Пример #5
0
def home_page():
    url = request.url
    favorite_video = []
    user_favorite = Video.find_video(session['account'])
    for video in user_favorite:
        favorite_video.append(video['Link'])

    page = request.form['page']
    soup = item.find_page_content(page)
    all_movie = item.find_home_movie(soup)
    all_page = item.page_bar()

    return render_template("home.html",
                           all_movie=all_movie,
                           url=url,
                           favorite_video=favorite_video,
                           all_page=all_page)
Пример #6
0
def hello():
    session['account'] = session.get('account')
    session['name'] = session.get('name')

    url = request.url
    favorite_video = []
    user_favorite = Video.find_video(session['account'])
    for video in user_favorite:
        favorite_video.append(video['Link'])

    home = "https://www.imovie4u.com/movies/"
    soup = item.find_home_content(home)
    all_movie = item.find_home_movie(soup)
    all_page = item.page_bar()

    return render_template("home.html",
                           all_movie=all_movie,
                           url=url,
                           favorite_video=favorite_video,
                           all_page=all_page)