-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathogaya.py
executable file
·87 lines (56 loc) · 2.11 KB
/
ogaya.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/python3
# -*- coding:Utf-8 -*-
"""
OGAYA − Off-Google-Account Youtube Aggregator.
Tests file.
This is a backfire to the remove of GDATA if you don't want to use a
Google account.
"""
# Imports ===============================================================#
import os
import ogaya_parsers as ogparsers
import ogaya_objects as ogobjects
import ogaya_utils as ogutils
# Variables globales ====================================================#
__author__ = "Etienne Nadji <[email protected]>"
# Classes ===============================================================#
# Fonctions =============================================================#
# Programme =============================================================#
if __name__ == "__main__":
# Youtube channel with the traditionnal naming system
old = ogobjects.YoutubeChannel(
username="ArtePlus7",
alias="Arte +7"
)
old.update("start")
for v in old.videos:
print (v.name,v.url)
input("Press ENTER to continue")
# Youtube channel with the new naming system
new = ogobjects.YoutubeChannel(
username="UCCMxHHciWRBBouzk-PGzmtQ",
alias="Bazar du grenier"
)
new.update("start")
for v in new.videos:
print (v.name,v.url)
input("Press ENTER to continue")
# Download an channel avatar
avatar = ogutils.get_urls("ArtePlus7","avatar")
ogutils.download(avatar,"arteplus7.{0}".format(avatar.split(".")[-1]))
input("Press ENTER to continue")
# Get latest videos of a channel avoiding YoutubeChannel
# object, but not YoutubeVideo object
feed = ogutils.get_urls("ArtePlus7","videos")
print ("Webpage",feed["page"])
print ("Webpage tempfile",feed["tempfile"])
input("Press ENTER to continue")
print ("Webpage content",feed["content"])
input("Press ENTER to continue")
os.remove(feed["tempfile"])
parser = ogparsers.YTParser()
videos = parser.get_videos(feed["content"])
for v in videos:
print (v.name,v.url)
input("Press ENTER to continue")
# vim:set shiftwidth=4 softtabstop=4: