movies_by_year.append(b)
            return movies_by_year

        movies = scrap_top_movies()
        pprint(group_by_year(movies))
    elif a == 3:
        movies = scrap_top_movies()
        pprint(movies_by_decade(movies))
    elif a == 4:
        movies = scrap_top_movies()
        pprint(movies)
        b = int(input('   enter the no. movie   '))
        url = movies[b - 1]['url']
        pprint(scrap_movies_details(url))
    elif a == 5:
        movies_list = scrap_top_movies()
        pprint(get_movie_list_details(movies_list))
    elif a == 6:
        movies_list = scrap_top_movies()
        movies = get_movie_list_details(movies_list)
        pprint(analyse_movie_director(movies))
    elif a == 7:
        movies_list = scrap_top_movies()
        movies = get_movie_list_details(movies_list)
        pprint(analyse_movie_language(movies))

    elif a == 0:
        break
    else:
        print('\t\t\tyou choose wrong option')
示例#2
0
from task5 import get_movie_list_details
from  task1 import scrap_top_list
from pprint import pprint
def analyse_language_and_directors(list_movies_details):
	movie_details = list_movies_details
	dict_Of_Directors = {}
	for movie in movie_details:
		for director in movie["Directors"]:
			dict_Of_Directors[director]={}
	for i in range (len(movie_details)):
		for director in dict_Of_Directors:
			if director in movie_details[i]["Directors"]:
				for language in movie_details[i]['Language']:
					dict_Of_Directors[director][language]=0
	for i in range (len(movie_details)):
		for director in dict_Of_Directors:
			if director in movie_details[i]["Directors"]:
				for language in movie_details[i]['Language']:
					dict_Of_Directors[director][language]+=1
	return dict_Of_Directors
scrap_top = scrap_top_list()
movie_details = get_movie_list_details(scrap_top)
pprint(analyse_language_and_directors(movie_details))

########################## task 7 ################################:
import requests, json
from pprint import pprint
from bs4 import BeautifulSoup
from task5 import get_movie_list_details
from task1 import scrape_top_list


def analyse_movies_directors(movie_dirceter):
    dirceters = {}
    for dirceter in movie_dirceter:
        a = ""
        for i in dirceter["director"]:
            a += i
        if a not in dirceters:
            dirceters[a] = 1
        else:
            dirceters[a] += 1
    return dirceters


dirceter_analyse = analyse_movies_directors(
    get_movie_list_details(scrape_top_list()[0:5]))
pprint(dirceter_analyse)
示例#4
0
import requests,pprint,os,json
from bs4 import BeautifulSoup
from task5 import get_movie_list_details
from task1 import scrape_top_list
from pprint import pprint

def analyse_movies_language(movie_list):
	languages = {}
	for movie in movie_list:
		for lang in movie["language"]:
			print(lang)
	# 		if lang not in languages:
	# 			languages[lang]=1
	# 		else:
	# 			languages[lang]+=1
	# return languages

language_analysis = analyse_movies_language(get_movie_list_details(scrape_top_list()[0:5]))
# pprint(language_analysis)


示例#5
0
import pprint
from task5 import get_movie_list_details
list_1 = get_movie_list_details()


def analyse_movies_directors():
    list_2 = []
    uni = []
    Dict = {}
    for i in list_1:
        a = i['director']
        # print(a)
        for j in a:
            list_2.append(j)
            if j not in uni:
                uni.append(j)
    # print(list_2)
    # print(uni)
    for m in uni:
        count = 0
        for n in list_2:
            if m == n:
                count += 1
        retunr(m, count)


analyse_movies_directors()