Esempio n. 1
0
from Kotube import get_info
import pandas as pd
from Youtube_URL import get_url



df = pd.DataFrame(columns=['title','length','rating','thumbnail','views','description'])



videolist = get_url('도넛버거',30)

for i in range(0,len(videolist)):

    video_info = get_info(videolist[i])

    df = df.append({
        'title': video_info['title'],
        'length': video_info['length'],
        'rating': video_info['rating'],
        'thumbnail': video_info['thumbnail'],
        'views': video_info['views'],
        'description': video_info['description']
    }, ignore_index=True)



df.to_csv()
df.to_csv('burger.csv', encoding='utf-8-sig', index=False)
Esempio n. 2
0
"""
db 연결 후 데이터 insert 예제 
"""
from Kotube import get_info
from Youtube_URL import get_url



videolist = get_url('파이썬',30)

import pymysql
# alter charset to 'utf8mb4' to insert imoji
conn = pymysql.connect(host='13.58.15.95', port= 3306, user='******',password='******',db='test')

cur = conn.cursor(pymysql.cursors.DictCursor)


for i in range(0,len(videolist)):
    
    video_info = get_info(videolist[i])

    sql = """
    insert into youtube 
    values (%s,%s,%s,%s,%s,%s,%s,now())
    """
    cur.execute(sql,
    (
        videolist[i], # url
        video_info['title'],
        video_info['length'],
        video_info['rating'],

def youtube_url_main(keyword, howmany):
    videolist = get_url(keyword,howmany)
    print(videolist)

df_raw = pd.read_pickle('glowpick_nodupl.pkl')
df = df_raw.copy()

result = pd.DataFrame(index=range(0,61))

for i, row in df.iterrows():
    keyword = row['상품명']
    # print(keyword)
    # print(type(keyword))
    url_list = get_url(keyword,3)
    for i in url_list:
        # print(i)
        # print(type(i))
        try:
            social_list = socialblade1(i)
        except:
            continue
        print(social_list)
        upload_date, sub = social_list[-2],social_list[-1][-1] # upload_date, sub
        #시간설정
        today = API_CLASS.convert_strtime(upload_date)
        start_date , enddate = API_CLASS.timeminus(today, -30), API_CLASS.timeminus(today, 30)
        #네이버api
        print('123123123123123123')
        try:
def youtube_url_main(keyword, howmany):
    videolist = get_url(keyword,howmany)
    print(videolist)
Esempio n. 5
0
from Kotube import get_ko_sub
from Youtube_URL import get_url

videolist = get_url('달고나커피', 20)

text = ''
for i in range(0, len(videolist)):
    text += get_ko_sub(videolist[i])