Example #1
0
def recommended_movies():
    all_recommended = []
    for liked_article in liked_articles:
        output = get_recommendations(liked_articles[2])
        for data in output:
            all_recommended.append(data)

    all_recommended.sort()
    all_recommended = list(
        all_recommended
        for all_recommended, _ in itertools.groupby(all_recommended))
    article_data = []
    for recommended in all_recommended:
        data = {
            "timestamp": all_articles[0][1],
            "eventType": all_articles[0][2],
            "contentId": all_articles[0][3],
            "authorPersonId": all_articles[0][4],
            "authorSessionId": all_articles[0][5],
            "authorUserAgent": all_articles[0][6],
            "authorRegion": all_articles[0][7],
            "authorCountry": all_articles[0][8],
            "contentType": all_articles[0][9],
            "url": all_articles[0][10],
            "title": all_articles[0][11],
            "lang": all_articles[0][12],
            "total_events": all_articles[0][13]
        }
        article_data.append(data)
    return jsonify({"data": article_data, "status": "success"}), 200
Example #2
0
def recommended_movies():
    all_recommended = []
    for liked_movie in liked_movies:
        output = get_recommendations(liked_movie[19])
        for data in output:
            all_recommended.append(data)
    import itertools
    all_recommended.sort()
    all_recommended.head()
    all_recommended = list(
        all_recommended
        for all_recommended, _ in itertools.groupby(all_recommended))
    all_recommended.head()
    movie_data = []
    for recommended in all_recommended:
        _d = {
            "title": recommended[0],
            "poster_link": recommended[1],
            "release_date": recommended[2] or "N/A",
            "duration": recommended[3],
            "rating": recommended[4],
            "overview": recommended[5]
        }
        movie_data.append(_d)
    return jsonify({"data": movie_data, "status": "success"}), 200
Example #3
0
def recommended_articles():
    all_recommended = []
    for liked_article in liked_articles:
        output = get_recommendations(liked_article[4])
        for data in output:
            all_recommended.append(data)
    import itertools
    all_recommended.sort()
    all_recommended = list(
        all_recommended
        for all_recommended, _ in itertools.groupby(all_recommended))
    article_data = []
    for recommended in all_recommended:
        _d = {
            "url": recommended[0],
            "title": recommended[1],
            "text": recommended[2],
            "lang": recommended[3],
            "total_events": recommended[4]
        }
        article_data.append(_d)
    return jsonify({"data": article_data, "status": "success"}), 200