<jupyter_start><jupyter_text>Imports  Libraries<jupyter_code>import youtube_dlc # pip install youtube-dlc
import pandas as pd
import numpy as np
pd.set_option('display.max_columns', 200)
ydl = youtube_dlc.YoutubeDL({'ignoreerrors':True})
array_querry = ['machine-learning',
 'scikit-learn',
 'regression',
 'time-series',
 'neural-networks',
 'classification',
 'statsmodels',
 'random-forest',
 'scipy',
 'logistic',
 'data-visualization',
 'distributions',
 'bayesian',
 'keras',
 'svm',
 'clustering',
 'correlation',
 'probability',
 'deep-learning',
 'forecasting',
 'cross-validation',
 'pca',
 'pandas',
 'numpy',
 'arima']
results = list()
for query in array_querry:
    query_concat = query + ' python'
    r = ydl.extract_info('ytsearchdate1000:\{}'.format(query_concat), download=False)
    for entry in r['entries']:
        if entry is not None:
            entry['query'] = query
    results += r['entries']
results = [e for e in results if e is not None]
len(results)
df = pd.DataFrame(results)

#columns = ['title', 'upload_date', 'view_count']
df['upload_date'] = pd.to_datetime(df['upload_date'])
df['days_since_publication'] = (pd.to_datetime('2021-01-01') - df['upload_date']) / np.timedelta64(1,'D')
df.sample(5)<jupyter_output><empty_output><jupyter_text>Convert to .csv<jupyter_code>df.to_csv('../Data/youtube_dlc/YouTubeStackExchangeQueryRaw.csv', index=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1676096181046676, 'fraction_numerical': 0.013437057991513438, 'mean_word_length': 5.802884615384615, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '564678', 'license': 'MIT', 'n_tokens_mistral': 531, 'n_tokens_neox': 502, 'n_words': 97, 'path': '01-WebScrape/03-YoutubeDataRaw.ipynb', 'repo_name': 'FabioCaffarello/Youtube-Video-Recommendations', 'size': '1414'}