def main(*args): channel_list_file_path = args[0] channel_list = channel_module.get_channel_list(channel_list_file_path) _convert_channel_data(channel_list) _convert_video_data(channel_list) _convert_date_series_video_view_data(channel_list) _convert_posting_interval(channel_list)
def main(*args): channel_list_file_path = args[0] channel_list = channel_module.get_channel_list(channel_list_file_path) for channel_id in channel_list: print(f"Download video list for channel ID: {channel_id} .") channel_data = channel_module.load_channel_from_file(channel_id) channel_data["videos"] = _fetch_all_videos_by_channel_id(channel_id) file_path = f"{settings.OUTPUT_DIR}/{channel_id}.json" _save_to_file(file_path, channel_data)
def main(*args): channel_list_file_path = args[0] channel_list = channel_module.get_channel_list(channel_list_file_path) for channel_id in channel_list: print(f"Download video statistics for channel ID: {channel_id} .") channel_detail = channel_module.load_channel_from_file(channel_id) video_list = _fetch_videos_by_channel_id(channel_id) if not video_list: continue videos = list(map(lambda v: _build_data(v), video_list)) channel_detail["videos"] = videos file_path = f"{settings.OUTPUT_DIR}/{channel_id}.json" _save_to_file(file_path, channel_detail)
from bokeh.io import save, output_file from bokeh.models.widgets import DataTable, TableColumn from bokeh.models import ColumnDataSource from bokeh.layouts import widgetbox import pandas as pd import modules.channel_module as channel_module channel_list_file_path = "./list.txt" channel_list = channel_module.get_channel_list(channel_list_file_path) output_file("make_table_posting_interval.html") df = pd.read_csv("./output/posting_interval.csv") source = ColumnDataSource(df) columns = [ TableColumn(field="Channel", title="Channel"), TableColumn(field="ViewCount", title="ViewCount"), TableColumn(field="SubscriberCount", title="SubscriberCount"), TableColumn(field="VideCount", title="VideCount"), TableColumn(field="PostingInterval", title="PostingInterval"), ] data_table = DataTable( source=source, columns=columns, fit_columns=True, width=1300, height=800 ) save(widgetbox([data_table], sizing_mode="scale_both"))