Youtube Video Link Bilgileri

Run Settings
LanguagePython
Language Version
Run Command
# -*- coding: utf-8 -*- # Author : by A&G from django.http import HttpResponse from django.shortcuts import render, render_to_response from bs4 import BeautifulSoup from django.template import RequestContext import requests # Create your views here. def index(request): connect = requests.get('https://www.youtube.com/feed/trending') if connect: content = connect.text bs = BeautifulSoup(content, 'html.parser') avt_start = bs.find_all('a', 'yt-uix-tile-link', limit=3) # avt = all video titles starting attract acn_start = bs.find_all('a', 'g-hovercard', limit=3) # acn = all channel name starting attract av = bs.find_all('ul li') # av = all views starting attract music_details = {'music_info' : [[], [], [],[]], } #all video titles append music_details list number= 0 for x,y in zip(avt_start, acn_start): number +=1 music_details['music_info'][number].append(x.get('title')) music_details['music_info'][number].append(y.get_text()) return render_to_response("index.html", {'music_details': music_details }, content_type=RequestContext(request)) else: return HttpResponse('İstenilen sayfaya bağlantı sağlanamadı.') # HTML {% for val in music_details.values %} {% for music_detail in val %} {{ music_detail.0 }} ==> {{ music_detail.1 }} <br> {% endfor %} {% endfor %}
Editor Settings
Theme
Key bindings
Full width
Lines