Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
# Wygenerowanie listy z YouTube import googleapiclient.discovery import googleapiclient.errors from googleapiclient.discovery import build import datetime import json import os today_date = datetime.datetime.now() up_to_date = today_date.strftime("%Y-%m-%dT%H:%M:%S%z+12:00") tomorrow_date = datetime.datetime.now() + datetime.timedelta(days=1) tomorrow_day = tomorrow_date.strftime("%Y-%m-%dT%H:%M:%S%z+00:00") api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' <=== YOUTUBE API KEY youtube = build('youtube', 'v3', developerKey = api_key) request = youtube.activities().list( part="snippet, contentDetails", channelId="UCCT_JGIn9I9FS6OTzzqWEew", # channelId="UCbX3YkedQunLt7EQAdVxh7w", publishedBefore=tomorrow_day ) response = request.execute() base_youtube_url = 'https://www.youtube.com/watch?v=' table = [] videos_id_table = [] pages_num = int(response['pageInfo']['resultsPerPage']) for x in range(pages_num): pub_data = response["items"][x]["snippet"]["publishedAt"] film_addr = base_youtube_url + response["items"][x]["contentDetails"]["upload"]["videoId"] film_title = response["items"][x]["snippet"]["title"] table.append(film_addr) videos_id_table.append(response["items"][x]["contentDetails"]["upload"]["videoId"]) #print(pub_data[0:10] , film_addr, " ", film_title) with open('/usr/share/hassio/homeassistant/www/data2.txt', 'w') as f: json.dump(table, f) with open('data.txt', 'w') as f: json.dump(table, f) #print(table[0])
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)