aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2019-12-04 15:09:32 -0500
committerJesús <heckyel@hyperbola.info>2019-12-04 15:09:32 -0500
commit6037dccec8f177d717a64f0a5b2a1393727044d5 (patch)
tree5d53c9b1ec624496415f08226a33b825ccf46226
parent58a8f9939883227b19e97cad7db5fc1ad360c21d (diff)
downloadlivie-6037dccec8f177d717a64f0a5b2a1393727044d5.tar.lz
livie-6037dccec8f177d717a64f0a5b2a1393727044d5.tar.xz
livie-6037dccec8f177d717a64f0a5b2a1393727044d5.zip
Replace to URL Freedom
-rw-r--r--livie.el2
-rw-r--r--livie.py9
2 files changed, 9 insertions, 2 deletions
diff --git a/livie.el b/livie.el
index 226d3f7..63c956c 100644
--- a/livie.el
+++ b/livie.el
@@ -47,7 +47,7 @@
:group 'livie
:type 'string)
-(defvar livie-youtube-regexp "https://www.youtube.com/watch\\?v=[A-Za-z0-9_\\-]\\{11\\}")
+(defvar livie-youtube-regexp "https://invidio.us/watch\\?v=[A-Za-z0-9_\\-]\\{11\\}")
(define-derived-mode livie-mode
special-mode "livie"
diff --git a/livie.py b/livie.py
index 5b5028a..4abddda 100644
--- a/livie.py
+++ b/livie.py
@@ -20,9 +20,16 @@ def replace(string):
string = string.replace(' views', '')
return string
+def urlFreedom(string):
+ """Replace to URL freedom"""
+ string = string.replace(
+ 'https://www.youtube.com',
+ 'https://invidio.us')
+ return string
+
for vid in SOUP.find_all(class_='yt-lockup-content'):
try:
- link = URL + vid.h3.a['href']
+ link = urlFreedom(URL + vid.h3.a['href'])
title = vid.h3.a.text
description = vid.h3.span.text
author = vid.find(class_='yt-lockup-byline').a.text